Blame SOURCES/0070-libblkid-fix-memory-leak-in-blkid_parse_tag_string.patch

531551
From 8af4232ff50154588c75f25a951b5619f05d0421 Mon Sep 17 00:00:00 2001
531551
From: Karel Zak <kzak@redhat.com>
531551
Date: Tue, 19 Nov 2013 17:52:56 +0100
531551
Subject: [PATCH 70/84] libblkid: fix memory leak in blkid_parse_tag_string()
531551
531551
Upstream: http://github.com/karelzak/util-linux/commit/c1178175e7adb35388a3e34495974d7f24f45d5d
531551
Upstream: http://github.com/karelzak/util-linux/commit/aab691cf8deb4a53782a0317b6f96c5d8b61f8e9
531551
Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=1335671
531551
Signed-off-by: Karel Zak <kzak@redhat.com>
531551
---
531551
 libblkid/src/tag.c | 14 +++++++++-----
531551
 1 file changed, 9 insertions(+), 5 deletions(-)
531551
531551
diff --git a/libblkid/src/tag.c b/libblkid/src/tag.c
531551
index 3a70950..3aede04 100644
531551
--- a/libblkid/src/tag.c
531551
+++ b/libblkid/src/tag.c
531551
@@ -237,14 +237,18 @@ int blkid_parse_tag_string(const char *token, char **ret_type, char **ret_val)
531551
 			goto errout; /* missing closing quote */
531551
 		*cp = '\0';
531551
 	}
531551
-	value = value && *value ? strdup(value) : NULL;
531551
-	if (!value)
531551
-		goto errout;
531551
+
531551
+	if (ret_val) {
531551
+		value = *value ? strdup(value) : NULL;
531551
+		if (!value)
531551
+			goto errout;
531551
+		*ret_val = value;
531551
+	}
531551
 
531551
 	if (ret_type)
531551
 		*ret_type = name;
531551
-	if (ret_val)
531551
-		*ret_val = value;
531551
+	else
531551
+		free(name);
531551
 
531551
 	return 0;
531551
 
531551
-- 
531551
2.7.4
531551