svn commit: trunk/busybox/libbb

vda at busybox.net vda at busybox.net
Wed Apr 23 07:22:31 UTC 2008


Author: vda
Date: 2008-04-23 00:22:31 -0700 (Wed, 23 Apr 2008)
New Revision: 21805

Log:
getopt32: fix "tar x" case; fix memory leak



Modified:
   trunk/busybox/libbb/getopt32.c


Changeset:
Modified: trunk/busybox/libbb/getopt32.c
===================================================================
--- trunk/busybox/libbb/getopt32.c	2008-04-23 07:02:02 UTC (rev 21804)
+++ trunk/busybox/libbb/getopt32.c	2008-04-23 07:22:31 UTC (rev 21805)
@@ -494,7 +494,7 @@
 	va_end(p);
 
 	if (spec_flgs & FIRST_ARGV_IS_OPT) {
-		if (argv[1] && argv[1][0] != '-' && argv[1][1] != '\0') {
+		if (argv[1] && argv[1][0] != '-' && argv[1][0] != '\0') {
 #if DONT_USE_PRINTF
 			char *pp = alloca(strlen(argv[1]) + 2);
 			*pp = '-';
@@ -502,8 +502,7 @@
 			argv[1] = pp;
 #else
 			argv[1] = xasprintf("-%s", argv[1]);
-			if (ENABLE_FEATURE_CLEAN_UP)
-				spec_flgs |= FREE_FIRST_ARGV_IS_OPT;
+			spec_flgs |= FREE_FIRST_ARGV_IS_OPT;
 #endif
 		}
 	}
@@ -586,10 +585,9 @@
 		}
 	}
 
-#if ENABLE_FEATURE_CLEAN_UP
 	if (spec_flgs & FREE_FIRST_ARGV_IS_OPT)
 		free(argv[1]);
-#endif
+
 	/* check depending requires for given options */
 	for (on_off = complementary; on_off->opt_char; on_off++) {
 		if (on_off->requires && (flags & on_off->switch_on) &&




More information about the busybox-cvs mailing list