mirror of
https://git.busybox.net/buildroot.git
synced 2024-12-14 07:43:32 +08:00
33 lines
815 B
Diff
33 lines
815 B
Diff
|
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;
|