aboutsummaryrefslogtreecommitdiffstats
path: root/package/keyutils/keyutils-02-another-memleak.patch
blob: f74fd79ba565d36ad4aa26e8d298aa0fcfe0cb52 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
Patch vampirised from Debian's packaging of keyutils-1.4

Author: Michael Gebetsroither <gebi@grml.org>
Description: Fixed another memleak (Closes: #496466).

diff -Naurp keyutils.orig/keyutils.c keyutils/keyutils.c
--- keyutils.orig/keyutils.c	2008-08-09 21:46:52.000000000 +0200
+++ keyutils/keyutils.c	2008-08-25 13:38:25.000000000 +0200
@@ -187,8 +187,10 @@ int keyctl_describe_alloc(key_serial_t i
 
 	for (;;) {
 		ret = keyctl_describe(id, buf, buflen);
-		if (ret < 0)
+		if (ret < 0) {
+            free(buf);
 			return -1;
+        }
 
 		if (buflen >= ret)
 			break;
@@ -226,8 +228,10 @@ int keyctl_read_alloc(key_serial_t id, v
 
 	for (;;) {
 		ret = keyctl_read(id, buf, buflen);
-		if (ret < 0)
+		if (ret < 0) {
+            free(buf);
 			return -1;
+        }
 
 		if (buflen >= ret)
 			break;