[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox-cvs
Subject:    svn commit: trunk/busybox: editors shell
From:       vda () busybox ! net (vda at busybox ! net)
Date:       2007-09-28 22:07:24
Message-ID: 20070928220724.17340300AB () busybox ! net
[Download RAW message or body]

Author: vda
Date: 2007-09-28 15:07:23 -0700 (Fri, 28 Sep 2007)
New Revision: 20103

Log:
fix "if (p) free(p)" constructs



Modified:
   trunk/busybox/editors/sed.c
   trunk/busybox/shell/ash.c
   trunk/busybox/shell/lash.c


Changeset:
Modified: trunk/busybox/editors/sed.c
===================================================================
--- trunk/busybox/editors/sed.c	2007-09-28 21:56:36 UTC (rev 20102)
+++ trunk/busybox/editors/sed.c	2007-09-28 22:07:23 UTC (rev 20103)
@@ -157,7 +157,7 @@
 		sed_cmd = sed_cmd_next;
 	}
 
-	if (G.hold_space) free(G.hold_space);
+	free(G.hold_space);
 
 	while (G.current_input_file < G.input_file_count)
 		fclose(G.input_file_list[G.current_input_file++]);

Modified: trunk/busybox/shell/ash.c
===================================================================
--- trunk/busybox/shell/ash.c	2007-09-28 21:56:36 UTC (rev 20102)
+++ trunk/busybox/shell/ash.c	2007-09-28 22:07:23 UTC (rev 20103)
@@ -5328,8 +5328,7 @@
 		p = buf;
 	}
 
-	if (in.buf)
-		free(in.buf);
+	free(in.buf);
 	if (in.fd >= 0) {
 		close(in.fd);
 		back_exitstatus = waitforjob(in.jp);
@@ -8788,8 +8787,7 @@
 	INT_OFF;
 	if (pf->fd >= 0)
 		close(pf->fd);
-	if (pf->buf)
-		free(pf->buf);
+	free(pf->buf);
 	while (pf->strpush)
 		popstring();
 	parsefile = pf->prev;
@@ -10330,8 +10328,7 @@
 #endif
 	savepbq = parsebackquote;
 	if (setjmp(jmploc.loc)) {
-		if (str)
-			free(str);
+		free(str);
 		parsebackquote = 0;
 		exception_handler = savehandler;
 		longjmp(exception_handler->loc, 1);
@@ -11264,8 +11261,7 @@
 			else
 				action = ckstrdup(action);
 		}
-		if (trap[signo])
-			free(trap[signo]);
+		free(trap[signo]);
 		trap[signo] = action;
 		if (signo != 0)
 			setsignal(signo);

Modified: trunk/busybox/shell/lash.c
===================================================================
--- trunk/busybox/shell/lash.c	2007-09-28 21:56:36 UTC (rev 20102)
+++ trunk/busybox/shell/lash.c	2007-09-28 22:07:23 UTC (rev 20103)
@@ -455,8 +455,7 @@
 	for (i = 0; i < cmd->num_progs; i++) {
 		free(cmd->progs[i].argv);
 #if ENABLE_LASH_PIPE_N_REDIRECTS
-		if (cmd->progs[i].redirects)
-			free(cmd->progs[i].redirects);
+		free(cmd->progs[i].redirects);
 #endif
 	}
 	free(cmd->progs);


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic