Bob Ciora's patch for "UpnpCreatePropertySet can leak memory".

git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@403 119443c7-1b9e-41f8-b6fc-b9c35fce742c
This commit is contained in:
Marcelo Roberto Jimenez
2008-06-02 23:08:02 +00:00
parent eb66b253e2
commit 441cf2e471
2 changed files with 25 additions and 1 deletions

View File

@@ -2,6 +2,30 @@
Version 1.8.0
*******************************************************************************
2008-06-02 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
* SF Bug Tracker [ 1942285 ]
UpnpCreatePropertySet can leak memory.
Submitted By: Bob Ciora - bobciora
In file upnp/src/api/upnptools.c, function UpnpCreatePropertySet can leak
memory if no additional arguments are passed. This is because of the
'return' statement at (or near) line 554.
The prior call to ixmlParseBufferEx may succeed. This causes a basic ixml
tree to be created. The return statement at line 554 leaves this tree in
memory without cleaning it up.
There are two options: either add code prior to the return at 554 to clean
up the tree, or simply allow a NumArg parameter of 0 to be passed.
I prefer the second method -- there doesn't seem to be any need to pass
*any* arguments to this function.
In my local copy of upnptools.c, I have simply replaced the "return NULL"
in line 554 to "return PropSet".
I've attached the source file.
2008-05-31 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
* Charles Nepveu's suggestion of not allocating a thread for
MiniServer when it is not compiled.

View File

@@ -387,7 +387,7 @@ IXML_Document *UpnpCreatePropertySet(
}
if (NumArg < 1) {
return NULL;
return PropSet;
}
va_start(ArgList, Arg);