Blame SOURCES/0047-parser_bison-type_identifier-string-memleak.patch

bacbc8
From 539029b8aee913dd391da66ecd0ac9ff2adb12ff Mon Sep 17 00:00:00 2001
bacbc8
From: Pablo Neira Ayuso <pablo@netfilter.org>
bacbc8
Date: Fri, 5 Apr 2019 14:09:56 +0200
bacbc8
Subject: [PATCH] parser_bison: type_identifier string memleak
bacbc8
bacbc8
==6297== 24 bytes in 3 blocks are definitely lost in loss record 2 of 13
bacbc8
==6297==    at 0x4C2BBAF: malloc (vg_replace_malloc.c:299)
bacbc8
==6297==    by 0x56193B9: strdup (strdup.c:42)
bacbc8
==6297==    by 0x4E758BD: xstrdup (utils.c:75)
bacbc8
==6297==    by 0x4E7F9D3: nft_parse (parser_bison.y:1895)
bacbc8
==6297==    by 0x4E7AAE1: nft_parse_bison_filename (libnftables.c:370)
bacbc8
==6297==    by 0x4E7AAE1: nft_run_cmd_from_filename (libnftables.c:438)
bacbc8
==6297==    by 0x109A33: main (main.c:310)
bacbc8
bacbc8
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
bacbc8
(cherry picked from commit 4d97f0a4eebd25d1639cd7c7ac2452445205a819)
bacbc8
Signed-off-by: Phil Sutter <psutter@redhat.com>
bacbc8
---
bacbc8
 src/parser_bison.y | 2 +-
bacbc8
 1 file changed, 1 insertion(+), 1 deletion(-)
bacbc8
bacbc8
diff --git a/src/parser_bison.y b/src/parser_bison.y
bacbc8
index 99d60822790dc..1dc83953ea858 100644
bacbc8
--- a/src/parser_bison.y
bacbc8
+++ b/src/parser_bison.y
bacbc8
@@ -1681,11 +1681,11 @@ data_type_atom_expr	:	type_identifier
bacbc8
 				if (dtype == NULL) {
bacbc8
 					erec_queue(error(&@1, "unknown datatype %s", $1),
bacbc8
 						   state->msgs);
bacbc8
-					xfree($1);
bacbc8
 					YYERROR;
bacbc8
 				}
bacbc8
 				$$ = constant_expr_alloc(&@1, dtype, dtype->byteorder,
bacbc8
 							 dtype->size, NULL);
bacbc8
+				xfree($1);
bacbc8
 			}
bacbc8
 			;
bacbc8
 
bacbc8
-- 
bacbc8
2.21.0
bacbc8