Fix resource leak 49/224349/1
authorHwankyu Jhun <h.jhun@samsung.com>
Mon, 10 Feb 2020 05:17:41 +0000 (14:17 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Mon, 10 Feb 2020 05:17:41 +0000 (14:17 +0900)
Change-Id: Ie11a830e97f13b55180ca8a5778a140502a1e963
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/aul_rsc_mgr_internal.c

index df33952..24562a7 100644 (file)
@@ -113,12 +113,18 @@ static char *_get_group_type(xmlNode *xml_node)
 
        tok = strtok_r(str, delim, &ptr);
        /* not a group element */
-       if (tok == NULL || strcmp(tok, "group"))
+       if (tok == NULL || strcmp(tok, "group")) {
+               free(str);
                return NULL;
+       }
+
        tok = strtok_r(NULL, delim, &ptr);
        /* invalid element */
-       if (tok == NULL)
+       if (tok == NULL) {
+               free(str);
                return NULL;
+       }
+
        ptr = strdup(tok);
        free(str);