Memory leak in libmxml1

Bug #1786425 reported by Marian Vevurka on 2018-08-10
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
mxml (Ubuntu)
Undecided
Unassigned

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)

Marian Vevurka (marian-vevurka) wrote :
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in mxml (Ubuntu):
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers