pan/symbol.c: fix memory leak for failure case
Signed-off-by: Wei,Jiangang <weijg.fnst@cn.fujitsu.com>
diff --git a/pan/symbol.c b/pan/symbol.c
index d7b90af..ca9964a 100644
--- a/pan/symbol.c
+++ b/pan/symbol.c
@@ -112,6 +112,7 @@
if (n->key == NULL) {
sym_error = "sym node strdup(key) failed!";
+ free(n);
return (NULL);
}
return (n);
@@ -204,8 +205,10 @@
nkey = strdup(key);
keys = splitstr(key, ",", NULL);
- if (keys == NULL)
+ if (keys == NULL) {
+ free(nkey);
return (EINVAL);
+ }
for (kk = (char **)keys, csym = sym;
*kk != NULL && (nsym = find_key1(csym->sym, *kk)) != NULL;