Bug 18987

Summary: Memory leaks in gc-web-service.c
Product: GeoClue Reporter: Csaba Kertész <csaba.kertesz>
Component: GeneralAssignee: Geoclue Bugs <geoclue-bugs>
Status: RESOLVED FIXED QA Contact: Geoclue Bugs <geoclue-bugs>
Severity: major    
Priority: highest    
Version: unspecified   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description Csaba Kertész 2008-12-09 13:03:37 UTC
1. Every time if you release the xmlXPathFreeContext(self->xpath_ctx);, this function does not release the processed self->xpath_ctx->doc, but it must be:

if (self->xpath_ctx && self->xpath_ctx->doc)
    xmlFreeDoc(self->xpath_ctx->doc);

2. In gc_web_service_get_string(), g_strdup does not need:

*value = g_strdup ((char*)xmlXPathCastNodeSetToString (obj->nodesetval));

->

*value = (char*)xmlXPathCastNodeSetToString (obj->nodesetval);

Such bugs can be avoided using unit tests+valgrind.

Cheers!
  kecsap
Comment 1 Jussi Kukkonen [inactive] 2008-12-10 12:20:12 UTC
Thanks Csaba, fixes are in git.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.