SHARE
TWEET

Valgrind output

ntr31954 Mar 22nd, 2019 (edited) 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. root@KALIWL:~/linkedlist# make runv
  2. Executing with valgrind...
  3. ==2352== Memcheck, a memory error detector
  4. ==2352== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
  5. ==2352== Using Valgrind-3.14.0 and LibVEX; rerun with -h for copyright info
  6. ==2352== Command: ./p2
  7. ==2352==
  8.  
  9. -------------------------------
  10. New node in head correct
  11. -------------------------------
  12. New node in middle correct
  13. -------------------------------
  14. New node in end correct
  15. -------------------------------
  16. :z:a:t:b:c:d:e:f:g:w    Node 'd' in position: 6
  17. -------------------------------
  18. -------------------------------
  19. :a:t:b:c:d:e:f:g:w
  20. -------------------------------
  21. -------------------------------
  22. After makeNull: :a:t:b:c:d:e:f:g:w
  23. -------------------------------
  24. Node number: 9
  25. -------------------------------
  26. ==2352== Invalid read of size 8
  27. ==2352==    at 0x10966D: listRemove(List*, int) (list.cc:100)
  28. ==2352==    by 0x109752: listMakeNull(List*) (list.cc:132)
  29. ==2352==    by 0x109E73: main (main.cc:49)
  30. ==2352==  Address 0x4d5bcd8 is 8 bytes inside a block of size 16 free'd
  31. ==2352==    at 0x4836EAB: operator delete(void*) (vg_replace_malloc.c:576)
  32. ==2352==    by 0x109684: listRemove(List*, int) (list.cc:101)
  33. ==2352==    by 0x109752: listMakeNull(List*) (list.cc:132)
  34. ==2352==    by 0x109E73: main (main.cc:49)
  35. ==2352==  Block was alloc'd at
  36. ==2352==    at 0x4835DEF: operator new(unsigned long) (vg_replace_malloc.c:334)
  37. ==2352==    by 0x1093F3: listNodeCreate(char) (list.cc:16)
  38. ==2352==    by 0x10946E: listInsert(List*, char, int) (list.cc:34)
  39. ==2352==    by 0x109A1B: main (main.cc:13)
  40. ==2352==
  41. ==2352== Invalid read of size 8
  42. ==2352==    at 0x10963E: listRemove(List*, int) (list.cc:95)
  43. ==2352==    by 0x109752: listMakeNull(List*) (list.cc:132)
  44. ==2352==    by 0x109E73: main (main.cc:49)
  45. ==2352==  Address 0x4d5beb8 is 8 bytes inside a block of size 16 free'd
  46. ==2352==    at 0x4836EAB: operator delete(void*) (vg_replace_malloc.c:576)
  47. ==2352==    by 0x109684: listRemove(List*, int) (list.cc:101)
  48. ==2352==    by 0x109752: listMakeNull(List*) (list.cc:132)
  49. ==2352==    by 0x109E73: main (main.cc:49)
  50. ==2352==  Block was alloc'd at
  51. ==2352==    at 0x4835DEF: operator new(unsigned long) (vg_replace_malloc.c:334)
  52. ==2352==    by 0x1093F3: listNodeCreate(char) (list.cc:16)
  53. ==2352==    by 0x10946E: listInsert(List*, char, int) (list.cc:34)
  54. ==2352==    by 0x109A1B: main (main.cc:13)
  55. ==2352==
  56. :1
  57. -------------------------------
  58. Node Number: 1
  59. -------------------------------
  60. ==2352==
  61. ==2352== HEAP SUMMARY:
  62. ==2352==     in use at exit: 48 bytes in 3 blocks
  63. ==2352==   total heap usage: 17 allocs, 14 frees, 74,005 bytes allocated
  64. ==2352==
  65. ==2352== 16 bytes in 1 blocks are definitely lost in loss record 1 of 3
  66. ==2352==    at 0x4835DEF: operator new(unsigned long) (vg_replace_malloc.c:334)
  67. ==2352==    by 0x1093F3: listNodeCreate(char) (list.cc:16)
  68. ==2352==    by 0x10946E: listInsert(List*, char, int) (list.cc:34)
  69. ==2352==    by 0x109A53: main (main.cc:17)
  70. ==2352==
  71. ==2352== 16 bytes in 1 blocks are definitely lost in loss record 2 of 3
  72. ==2352==    at 0x4835DEF: operator new(unsigned long) (vg_replace_malloc.c:334)
  73. ==2352==    by 0x1093F3: listNodeCreate(char) (list.cc:16)
  74. ==2352==    by 0x1094B8: listInsert(List*, char, int) (list.cc:42)
  75. ==2352==    by 0x109B59: main (main.cc:28)
  76. ==2352==
  77. ==2352== 16 bytes in 1 blocks are definitely lost in loss record 3 of 3
  78. ==2352==    at 0x4835DEF: operator new(unsigned long) (vg_replace_malloc.c:334)
  79. ==2352==    by 0x1093F3: listNodeCreate(char) (list.cc:16)
  80. ==2352==    by 0x10946E: listInsert(List*, char, int) (list.cc:34)
  81. ==2352==    by 0x109E89: main (main.cc:50)
  82. ==2352==
  83. ==2352== LEAK SUMMARY:
  84. ==2352==    definitely lost: 48 bytes in 3 blocks
  85. ==2352==    indirectly lost: 0 bytes in 0 blocks
  86. ==2352==      possibly lost: 0 bytes in 0 blocks
  87. ==2352==    still reachable: 0 bytes in 0 blocks
  88. ==2352==         suppressed: 0 bytes in 0 blocks
  89. ==2352==
  90. ==2352== For counts of detected and suppressed errors, rerun with: -v
  91. ==2352== ERROR SUMMARY: 11 errors from 5 contexts (suppressed: 0 from 0)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top