[Bug 1786425] [NEW] Memory leak in libmxml1

Marian Vevurka marian.vevurka at gmail.com
Fri Aug 10 08:01:18 UTC 2018


Public bug reported:

There is a memory leak in mxmlDelete, already reported
[https://github.com/michaelrsweet/mxml/issues/183] to original
maintainer and fixed in mxml 2.11

leak.cpp:

#include <mxml.h>

int main(int, char const*[])
{
   mxml_node_t *pDoc = mxmlNewXML("1.0");
   mxml_node_t *pRoot = mxmlNewElement(pDoc, "root");
   mxml_node_t *pNode1 = mxmlNewElement(pRoot, "lev1");
   mxmlDelete(pDoc);
   return 0;
}

$ LDLIBS=-lmxml CPPFLAGS=-g make leak

$ valgrind --leak-check=full ./leak
==24403== Memcheck, a memory error detector
==24403== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==24403== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==24403== Command: ./leak
==24403==
==24403==
==24403== HEAP SUMMARY:
==24403==     in use at exit: 93 bytes in 2 blocks
==24403==   total heap usage: 6 allocs, 4 frees, 311 bytes allocated
==24403==
==24403== 93 (88 direct, 5 indirect) bytes in 1 blocks are definitely lost in loss record 2 of 2
==24403==    at 0x4C31B25: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==24403==    by 0x4E43F58: ??? (in /usr/lib/x86_64-linux-gnu/libmxml.so.1.5)
==24403==    by 0x4E44024: mxmlNewElement (in /usr/lib/x86_64-linux-gnu/libmxml.so.1.5)
==24403==    by 0x1087DB: main (leak.cpp:6)
==24403==
==24403== LEAK SUMMARY:
==24403==    definitely lost: 88 bytes in 1 blocks
==24403==    indirectly lost: 5 bytes in 1 blocks
==24403==      possibly lost: 0 bytes in 0 blocks
==24403==    still reachable: 0 bytes in 0 blocks
==24403==         suppressed: 0 bytes in 0 blocks
==24403==
==24403== For counts of detected and suppressed errors, rerun with: -v
==24403== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)

ProblemType: Bug
DistroRelease: Ubuntu 18.04
Package: libmxml1 2.10-1
ProcVersionSignature: Ubuntu 4.15.0-23.25-generic 4.15.18
Uname: Linux 4.15.0-23-generic x86_64
ApportVersion: 2.20.9-0ubuntu7.2
Architecture: amd64
Date: Fri Aug 10 07:53:31 2018
SourcePackage: mxml
UpgradeStatus: No upgrade log present (probably fresh install)

** Affects: mxml (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: amd64 apport-bug bionic uec-images

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to mxml in Ubuntu.
https://bugs.launchpad.net/bugs/1786425

Title:
  Memory leak in libmxml1

Status in mxml package in Ubuntu:
  New

Bug description:
  There is a memory leak in mxmlDelete, already reported
  [https://github.com/michaelrsweet/mxml/issues/183] to original
  maintainer and fixed in mxml 2.11

  leak.cpp:

  #include <mxml.h>

  int main(int, char const*[])
  {
     mxml_node_t *pDoc = mxmlNewXML("1.0");
     mxml_node_t *pRoot = mxmlNewElement(pDoc, "root");
     mxml_node_t *pNode1 = mxmlNewElement(pRoot, "lev1");
     mxmlDelete(pDoc);
     return 0;
  }

  $ LDLIBS=-lmxml CPPFLAGS=-g make leak

  $ valgrind --leak-check=full ./leak
  ==24403== Memcheck, a memory error detector
  ==24403== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
  ==24403== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
  ==24403== Command: ./leak
  ==24403==
  ==24403==
  ==24403== HEAP SUMMARY:
  ==24403==     in use at exit: 93 bytes in 2 blocks
  ==24403==   total heap usage: 6 allocs, 4 frees, 311 bytes allocated
  ==24403==
  ==24403== 93 (88 direct, 5 indirect) bytes in 1 blocks are definitely lost in loss record 2 of 2
  ==24403==    at 0x4C31B25: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
  ==24403==    by 0x4E43F58: ??? (in /usr/lib/x86_64-linux-gnu/libmxml.so.1.5)
  ==24403==    by 0x4E44024: mxmlNewElement (in /usr/lib/x86_64-linux-gnu/libmxml.so.1.5)
  ==24403==    by 0x1087DB: main (leak.cpp:6)
  ==24403==
  ==24403== LEAK SUMMARY:
  ==24403==    definitely lost: 88 bytes in 1 blocks
  ==24403==    indirectly lost: 5 bytes in 1 blocks
  ==24403==      possibly lost: 0 bytes in 0 blocks
  ==24403==    still reachable: 0 bytes in 0 blocks
  ==24403==         suppressed: 0 bytes in 0 blocks
  ==24403==
  ==24403== For counts of detected and suppressed errors, rerun with: -v
  ==24403== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)

  ProblemType: Bug
  DistroRelease: Ubuntu 18.04
  Package: libmxml1 2.10-1
  ProcVersionSignature: Ubuntu 4.15.0-23.25-generic 4.15.18
  Uname: Linux 4.15.0-23-generic x86_64
  ApportVersion: 2.20.9-0ubuntu7.2
  Architecture: amd64
  Date: Fri Aug 10 07:53:31 2018
  SourcePackage: mxml
  UpgradeStatus: No upgrade log present (probably fresh install)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/mxml/+bug/1786425/+subscriptions



More information about the foundations-bugs mailing list