From: Liping Zhang Date: Sun, 28 Aug 2016 08:36:22 +0000 (+0800) Subject: meta: fix memory leak in tc classid parser X-Git-Tag: v0.7~92 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d815b8d2bf18bc589f10c3fb4524a2b93fe91b93;p=thirdparty%2Fnftables.git meta: fix memory leak in tc classid parser We forgot to free the str which was allocated by xstrdup, so memory leak will happen. Signed-off-by: Liping Zhang Signed-off-by: Pablo Neira Ayuso --- diff --git a/src/meta.c b/src/meta.c index 5a6fee5c..87eafeea 100644 --- a/src/meta.c +++ b/src/meta.c @@ -90,7 +90,7 @@ static struct error_record *tchandle_type_parse(const struct expr *sym, struct expr **res) { uint32_t handle; - char *str; + char *str = NULL; if (strcmp(sym->identifier, "root") == 0) handle = TC_H_ROOT; @@ -127,6 +127,7 @@ static struct error_record *tchandle_type_parse(const struct expr *sym, handle = strtoull(sym->identifier, NULL, 0); } out: + xfree(str); *res = constant_expr_alloc(&sym->location, sym->dtype, BYTEORDER_HOST_ENDIAN, sizeof(handle) * BITS_PER_BYTE, &handle);