]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
[Core] Fix leak in switch_xml_set_attr().
authorAndrey Volk <andywolk@gmail.com>
Mon, 27 Apr 2020 13:22:32 +0000 (17:22 +0400)
committerAndrey Volk <andywolk@gmail.com>
Tue, 28 Apr 2020 17:43:58 +0000 (21:43 +0400)
src/switch_xml.c

index 42424ef3a335b80a43dc88a943066b9e566c6436..b05358741c96258086269842c82e45b92844e499 100644 (file)
@@ -2984,8 +2984,7 @@ SWITCH_DECLARE(switch_xml_t) switch_xml_set_attr(switch_xml_t xml, const char *n
                        return xml;                     /* nothing to do */
                if (xml->attr == SWITCH_XML_NIL) {      /* first attribute */
                        xml->attr = (char **) switch_must_malloc(4 * sizeof(char *));
-                       xml->attr[1] = switch_must_strdup("");  /* empty list of malloced names/vals */
-                       xml->attr[l + 1] = switch_must_strdup("");
+                       xml->attr[l + 1] = switch_must_strdup("");      /* empty list of malloced names/vals */
                } else {
                        xml->attr = (char **) switch_must_realloc(xml->attr, (l + 4) * sizeof(char *));
                }