Advertisement
Programator2

Valgrind example output

Mar 31st, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.98 KB | None | 0 0
  1. ==3455== Memcheck, a memory error detector
  2. ==3455== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
  3. ==3455== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
  4. ==3455== Command: ./todo1
  5. ==3455==
  6. ==3455==
  7. ==3455== HEAP SUMMARY:
  8. ==3455== in use at exit: 160 bytes in 10 blocks
  9. ==3455== total heap usage: 10 allocs, 0 frees, 160 bytes allocated
  10. ==3455==
  11. ==3455== 160 bytes in 10 blocks are definitely lost in loss record 1 of 1
  12. ==3455== at 0x4C2FB0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
  13. ==3455== by 0x108664: main (in /home/os2018/Documents/ctodo/todo1)
  14. ==3455==
  15. ==3455== LEAK SUMMARY:
  16. ==3455== definitely lost: 160 bytes in 10 blocks
  17. ==3455== indirectly lost: 0 bytes in 0 blocks
  18. ==3455== possibly lost: 0 bytes in 0 blocks
  19. ==3455== still reachable: 0 bytes in 0 blocks
  20. ==3455== suppressed: 0 bytes in 0 blocks
  21. ==3455==
  22. ==3455== For counts of detected and suppressed errors, rerun with: -v
  23. ==3455== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
  24.  
  25.  
  26. ==3418== Memcheck, a memory error detector
  27. ==3418== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
  28. ==3418== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
  29. ==3418== Command: ./todo
  30. ==3418==
  31. ==3418== Invalid write of size 1
  32. ==3418== at 0x1091B5: parse_todo_item (todo.c:62)
  33. ==3418== by 0x1092EF: load_todo_items (todo.c:107)
  34. ==3418== by 0x108F4C: main (main.c:10)
  35. ==3418== Address 0x522e49b is 2 bytes after a block of size 25 alloc'd
  36. ==3418== at 0x4C2FB0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
  37. ==3418== by 0x109146: parse_todo_item (todo.c:58)
  38. ==3418== by 0x1092EF: load_todo_items (todo.c:107)
  39. ==3418== by 0x108F4C: main (main.c:10)
  40. ==3418==
  41.  
  42. #include <stdlib.h>
  43.  
  44. int main(void) {
  45. int i =0;
  46. char* buffer;
  47.  
  48. while (i < 10) {
  49. buffer = (char*) malloc(16);
  50. i++;
  51. }
  52. return 0;
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement