Browse Source

Cherry-pick upstram commit FILE5_17-8-gc0c0032 "Fix memory leak". Closes: #740694

Christoph Biedl 10 years ago
parent
commit
27fde6ab93
2 changed files with 29 additions and 0 deletions
  1. 28 0
      debian/patches/cherry-pick.c0c0032.fix-memory-leak.patch
  2. 1 0
      debian/patches/series

+ 28 - 0
debian/patches/cherry-pick.c0c0032.fix-memory-leak.patch

@@ -0,0 +1,28 @@
+Upstream-Author: Christos Zoulas <christos@zoulas.com>
+Date: Fri Feb 21 14:32:48 2014 +0000
+Upstream-Commit: c0c0032b9e9eb57b91fefef905a3b018bab492d9
+Description:
+ Fix memory leak (Anatol Belski)
+
+--- a/src/softmagic.c
++++ b/src/softmagic.c
+@@ -1755,12 +1755,16 @@
+ 		ms->offset = soffset;
+ 		if (rv == 1) {
+ 			if ((ms->flags & (MAGIC_MIME|MAGIC_APPLE)) == 0 &&
+-			    file_printf(ms, F(m->desc, "%u"), offset) == -1)
++			    file_printf(ms, F(m->desc, "%u"), offset) == -1) {
++				free(rbuf);
+ 				return -1;
+-			if (file_printf(ms, "%s", rbuf) == -1)
++			}
++			if (file_printf(ms, "%s", rbuf) == -1) {
++				free(rbuf);
+ 				return -1;
+-			free(rbuf);
++			}
+ 		}
++		free(rbuf);
+ 		return rv;
+ 
+ 	case FILE_USE:

+ 1 - 0
debian/patches/series

@@ -10,3 +10,4 @@
 0011-btrfs.patch
 0012-lxt.patch
 cherry-pick.eced9db.python-over-detection.patch
+cherry-pick.c0c0032.fix-memory-leak.patch