diff options
author | Christopher James Lahey <clahey@helixcode.com> | 2000-05-16 20:16:16 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2000-05-16 20:16:16 +0800 |
commit | 277df4a98d11e14f7029030905e65a0804a886ff (patch) | |
tree | 36619f28453cbfe4cadafd53108fbe0efffdebf8 | |
parent | f6c356b11614f99acc3c0650be1b740caeb589db (diff) | |
download | gsoc2013-evolution-277df4a98d11e14f7029030905e65a0804a886ff.tar.gz gsoc2013-evolution-277df4a98d11e14f7029030905e65a0804a886ff.tar.zst gsoc2013-evolution-277df4a98d11e14f7029030905e65a0804a886ff.zip |
xmlGetProp appears to return malloced memory. Thus we must free it.
2000-05-16 Christopher James Lahey <clahey@helixcode.com>
* e-xml-utils.c: xmlGetProp appears to return malloced memory.
Thus we must free it.
svn path=/trunk/; revision=3087
-rw-r--r-- | e-util/ChangeLog | 5 | ||||
-rw-r--r-- | e-util/e-xml-utils.c | 11 | ||||
-rw-r--r-- | e-util/e-xml-utils.c-56826 | 11 |
3 files changed, 19 insertions, 8 deletions
diff --git a/e-util/ChangeLog b/e-util/ChangeLog index a672adfa2d..7f2d602f62 100644 --- a/e-util/ChangeLog +++ b/e-util/ChangeLog @@ -1,3 +1,8 @@ +2000-05-16 Christopher James Lahey <clahey@helixcode.com> + + * e-xml-utils.c: xmlGetProp appears to return malloced memory. + Thus we must free it. + 2000-05-15 Ettore Perazzoli <ettore@helixcode.com> * e-util.c (e_free_string_list): New function. diff --git a/e-util/e-xml-utils.c b/e-util/e-xml-utils.c index 33b9d28235..89f8591e8a 100644 --- a/e-util/e-xml-utils.c +++ b/e-util/e-xml-utils.c @@ -23,6 +23,7 @@ #include <locale.h> #include "e-xml-utils.h" #include <gnome-xml/parser.h> +#include <gnome-xml/xmlmemory.h> xmlNode *e_xml_get_child_by_name(xmlNode *parent, const xmlChar *child_name) @@ -74,15 +75,17 @@ int e_xml_get_integer_prop_by_name(xmlNode *parent, const xmlChar *prop_name) { xmlChar *prop; + int ret_val = 0; g_return_val_if_fail (parent != NULL, 0); g_return_val_if_fail (prop_name != NULL, 0); prop = xmlGetProp(parent, prop_name); - if (prop) - return atoi(prop); - else - return 0; + if (prop) { + ret_val = atoi(prop); + xmlFree(prop); + } + return ret_val; } void diff --git a/e-util/e-xml-utils.c-56826 b/e-util/e-xml-utils.c-56826 index 33b9d28235..89f8591e8a 100644 --- a/e-util/e-xml-utils.c-56826 +++ b/e-util/e-xml-utils.c-56826 @@ -23,6 +23,7 @@ #include <locale.h> #include "e-xml-utils.h" #include <gnome-xml/parser.h> +#include <gnome-xml/xmlmemory.h> xmlNode *e_xml_get_child_by_name(xmlNode *parent, const xmlChar *child_name) @@ -74,15 +75,17 @@ int e_xml_get_integer_prop_by_name(xmlNode *parent, const xmlChar *prop_name) { xmlChar *prop; + int ret_val = 0; g_return_val_if_fail (parent != NULL, 0); g_return_val_if_fail (prop_name != NULL, 0); prop = xmlGetProp(parent, prop_name); - if (prop) - return atoi(prop); - else - return 0; + if (prop) { + ret_val = atoi(prop); + xmlFree(prop); + } + return ret_val; } void |