From 07489c1155c93ef77351b012a88f336c0fc4aba0 Mon Sep 17 00:00:00 2001 From: Fabrice Fontaine Date: Mon, 5 Mar 2012 11:58:54 +0100 Subject: [PATCH] SF Bug Tracker id 3496942 - Memory leak in config_description_doc Submitted: Fabrice Fontaine ( ffontaine ) - 2012-03-05 01:55:54 PST element was not freed if membuffer_append_str(&url_str, "http://") does not return 0. Moreover addNew was not used. (cherry picked from commit da244683cf0ca5cc8e686b64c9afb654cc47bfc2) --- ChangeLog | 9 +++++++++ upnp/src/urlconfig/urlconfig.c | 6 ++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index c3a2368..751a023 100644 --- a/ChangeLog +++ b/ChangeLog @@ -299,6 +299,15 @@ Version 1.8.0 Version 1.6.16 ******************************************************************************* +2012-03-05 Fabrice Fontaine + + SF Bug Tracker id 3496942 - Memory leak in config_description_doc + + Submitted: Fabrice Fontaine ( ffontaine ) - 2012-03-05 01:55:54 PST + + element was not freed if membuffer_append_str(&url_str, "http://") does + not return 0. Moreover addNew was not used. + 2012-03-05 Fabrice Fontaine SF Bug Tracker id 3496938 - Missing structures initialisation in some functions diff --git a/upnp/src/urlconfig/urlconfig.c b/upnp/src/urlconfig/urlconfig.c index da24afe..e94c767 100644 --- a/upnp/src/urlconfig/urlconfig.c +++ b/upnp/src/urlconfig/urlconfig.c @@ -2,6 +2,7 @@ * * Copyright (c) 2000-2003 Intel Corporation * All rights reserved. + * Copyright (c) 2012 France Telecom All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -211,10 +212,8 @@ static int config_description_doc( IN const char *ip_str, OUT char **root_path_str ) { - int addNew = FALSE; IXML_NodeList *baseList; IXML_Element *element = NULL; - IXML_Element *newElement = NULL; IXML_Node *textNode = NULL; IXML_Node *rootNode = NULL; IXML_Node *urlbase_node = NULL; @@ -232,7 +231,6 @@ static int config_description_doc( baseList = ixmlDocument_getElementsByTagName(doc, urlBaseStr); if (baseList == NULL) { /* urlbase not found -- create new one */ - addNew = TRUE; element = ixmlDocument_createElement(doc, urlBaseStr); if (element == NULL) { goto error_handler; @@ -319,7 +317,7 @@ static int config_description_doc( error_handler: if (err_code != UPNP_E_SUCCESS) { - ixmlElement_free(newElement); + ixmlElement_free(element); } ixmlNodeList_free(baseList); membuffer_destroy(&root_path);