[BusyBox-cvs] CVS update of busybox/libbb (xreadlink.c)

Glenn McGrath bug1 at codepoet.org
Wed Aug 11 03:50:31 UTC 2004


    Date: Tuesday, August 10, 2004 @ 21:50:31
  Author: bug1
    Path: /var/cvs/busybox/libbb

Modified: xreadlink.c (1.5 -> 1.6)

Patch from Tito to fix memory leak upon error.


Index: busybox/libbb/xreadlink.c
diff -u busybox/libbb/xreadlink.c:1.5 busybox/libbb/xreadlink.c:1.6
--- busybox/libbb/xreadlink.c:1.5	Mon Mar 15 01:28:44 2004
+++ busybox/libbb/xreadlink.c	Tue Aug 10 21:50:30 2004
@@ -24,8 +24,9 @@
 		buf = xrealloc(buf, bufsize += GROWBY);
 		readsize = readlink(path, buf, bufsize); /* 1st try */
 		if (readsize == -1) {
-                   bb_perror_msg("%s", path);
-		    return NULL;
+			bb_perror_msg("%s", path);
+			free(buf);
+			return NULL;
 		}
 	}
 	while (bufsize < readsize + 1);



More information about the busybox-cvs mailing list