Guest User

Untitled

a guest
Feb 22nd, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.21 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <libxml/parser.h>
  5.  
  6. /*
  7. *
  8. */
  9. int main(int argc, char** argv) {
  10.  
  11. xmlDoc *document = NULL;
  12. xmlInitParser();
  13. document = xmlReadFile("./parameter.xml", NULL, 0);
  14. if (document == NULL) {
  15. printf("Failure on read xml filern");
  16. exit(EXIT_FAILURE);
  17. }
  18. if (document != NULL) {
  19. xmlFreeDoc(document);
  20. }
  21. /*
  22. * Cleanup function for the XML library.
  23. */
  24. xmlCleanupParser();
  25. /*
  26. * this is to debug memory for regression tests
  27. */
  28. xmlMemoryDump();
  29. exit(EXIT_SUCCESS);
  30. }
  31.  
  32. valgrind --leak-check=full --show-leak-kinds=all --tool=memcheck --leak-check=yes ./test
  33.  
  34. ==21214== Command: ./test
  35. ==21214==
  36. ==21214==
  37. ==21214== HEAP SUMMARY:
  38. ==21214== in use at exit: 76 bytes in 2 blocks
  39. ==21214== total heap usage: 128 allocs, 126 frees, 128,784 bytes allocated
  40. ==21214==
  41. ==21214== 32 bytes in 1 blocks are still reachable in loss record 1 of 2
  42. ==21214== at 0x4C2DBC5: calloc (vg_replace_malloc.c:711)
  43. ==21214== by 0x589760E: _dlerror_run (dlerror.c:141)
  44. ==21214== by 0x5896F81: dlopen@@GLIBC_2.2.5 (dlopen.c:87)
  45. ==21214== by 0x7F564D5: ??? (in /lib/x86_64-linux-gnu/liblzma.so.5.2.2)
  46. ==21214== by 0x7F5CDC7: lzma_auto_decoder (in /lib/x86_64-linux-gnu/liblzma.so.5.2.2)
  47. ==21214== by 0x4F93CE4: ??? (in /usr/lib/x86_64-linux-gnu/libxml2.so.2.9.4)
  48. ==21214== by 0x4F95267: __libxml2_xzread (in /usr/lib/x86_64-linux-gnu/libxml2.so.2.9.4)
  49. ==21214== by 0x4EA94E8: ??? (in /usr/lib/x86_64-linux-gnu/libxml2.so.2.9.4)
  50. ==21214== by 0x4EAB318: xmlParserInputBufferGrow (in /usr/lib/x86_64-linux-gnu/libxml2.so.2.9.4)
  51. ==21214== by 0x4E707A4: xmlParserInputGrow (in /usr/lib/x86_64-linux-gnu/libxml2.so.2.9.4)
  52. ==21214== by 0x4E76BB3: ??? (in /usr/lib/x86_64-linux-gnu/libxml2.so.2.9.4)
  53. ==21214== by 0x4E8C194: xmlParseDocument (in /usr/lib/x86_64-linux-gnu/libxml2.so.2.9.4)
  54. ==21214==
  55. ==21214== 44 bytes in 1 blocks are still reachable in loss record 2 of 2
  56. ==21214== at 0x4C2BBAF: malloc (vg_replace_malloc.c:299)
  57. ==21214== by 0x400F510: _dl_signal_error (dl-error.c:90)
  58. ==21214== by 0x40138CC: _dl_open (dl-open.c:714)
  59. ==21214== by 0x5896EE8: dlopen_doit (dlopen.c:66)
  60. ==21214== by 0x400F753: _dl_catch_error (dl-error.c:187)
  61. ==21214== by 0x5897530: _dlerror_run (dlerror.c:163)
  62. ==21214== by 0x5896F81: dlopen@@GLIBC_2.2.5 (dlopen.c:87)
  63. ==21214== by 0x7F564D5: ??? (in /lib/x86_64-linux-gnu/liblzma.so.5.2.2)
  64. ==21214== by 0x7F5CDC7: lzma_auto_decoder (in /lib/x86_64-linux-gnu/liblzma.so.5.2.2)
  65. ==21214== by 0x4F93CE4: ??? (in /usr/lib/x86_64-linux-gnu/libxml2.so.2.9.4)
  66. ==21214== by 0x4F95267: __libxml2_xzread (in /usr/lib/x86_64-linux-gnu/libxml2.so.2.9.4)
  67. ==21214== by 0x4EA94E8: ??? (in /usr/lib/x86_64-linux-gnu/libxml2.so.2.9.4)
  68. ==21214==
  69. ==21214== LEAK SUMMARY:
  70. ==21214== definitely lost: 0 bytes in 0 blocks
  71. ==21214== indirectly lost: 0 bytes in 0 blocks
  72. ==21214== possibly lost: 0 bytes in 0 blocks
  73. ==21214== still reachable: 76 bytes in 2 blocks
  74. ==21214== suppressed: 0 bytes in 0 blocks
  75. ==21214==
  76. ==21214== For counts of detected and suppressed errors, rerun with: -v
  77. ==21214== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
Add Comment
Please, Sign In to add comment