aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-09-28 22:07:23 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-09-28 22:07:23 +0000
commit6081868ee33c44f5a7227b77876d7e7a83c8aa9e (patch)
tree15efd13947c3a22f640168e535b694d318be9704
parente918e155ed1d36522e0c096e43d275f1ebda0515 (diff)
downloadbusybox-w32-6081868ee33c44f5a7227b77876d7e7a83c8aa9e.tar.gz
busybox-w32-6081868ee33c44f5a7227b77876d7e7a83c8aa9e.tar.bz2
busybox-w32-6081868ee33c44f5a7227b77876d7e7a83c8aa9e.zip
fix "if (p) free(p)" constructs
-rw-r--r--editors/sed.c2
-rw-r--r--shell/ash.c12
-rw-r--r--shell/lash.c3
3 files changed, 6 insertions, 11 deletions
diff --git a/editors/sed.c b/editors/sed.c
index a2e2b7349..dcdf382dc 100644
--- a/editors/sed.c
+++ b/editors/sed.c
@@ -157,7 +157,7 @@ static void sed_free_and_close_stuff(void)
157 sed_cmd = sed_cmd_next; 157 sed_cmd = sed_cmd_next;
158 } 158 }
159 159
160 if (G.hold_space) free(G.hold_space); 160 free(G.hold_space);
161 161
162 while (G.current_input_file < G.input_file_count) 162 while (G.current_input_file < G.input_file_count)
163 fclose(G.input_file_list[G.current_input_file++]); 163 fclose(G.input_file_list[G.current_input_file++]);
diff --git a/shell/ash.c b/shell/ash.c
index a3bfe3977..183911ccc 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -5328,8 +5328,7 @@ expbackq(union node *cmd, int quoted, int quotes)
5328 p = buf; 5328 p = buf;
5329 } 5329 }
5330 5330
5331 if (in.buf) 5331 free(in.buf);
5332 free(in.buf);
5333 if (in.fd >= 0) { 5332 if (in.fd >= 0) {
5334 close(in.fd); 5333 close(in.fd);
5335 back_exitstatus = waitforjob(in.jp); 5334 back_exitstatus = waitforjob(in.jp);
@@ -8788,8 +8787,7 @@ popfile(void)
8788 INT_OFF; 8787 INT_OFF;
8789 if (pf->fd >= 0) 8788 if (pf->fd >= 0)
8790 close(pf->fd); 8789 close(pf->fd);
8791 if (pf->buf) 8790 free(pf->buf);
8792 free(pf->buf);
8793 while (pf->strpush) 8791 while (pf->strpush)
8794 popstring(); 8792 popstring();
8795 parsefile = pf->prev; 8793 parsefile = pf->prev;
@@ -10330,8 +10328,7 @@ parsebackq: {
10330#endif 10328#endif
10331 savepbq = parsebackquote; 10329 savepbq = parsebackquote;
10332 if (setjmp(jmploc.loc)) { 10330 if (setjmp(jmploc.loc)) {
10333 if (str) 10331 free(str);
10334 free(str);
10335 parsebackquote = 0; 10332 parsebackquote = 0;
10336 exception_handler = savehandler; 10333 exception_handler = savehandler;
10337 longjmp(exception_handler->loc, 1); 10334 longjmp(exception_handler->loc, 1);
@@ -11264,8 +11261,7 @@ trapcmd(int argc, char **argv)
11264 else 11261 else
11265 action = ckstrdup(action); 11262 action = ckstrdup(action);
11266 } 11263 }
11267 if (trap[signo]) 11264 free(trap[signo]);
11268 free(trap[signo]);
11269 trap[signo] = action; 11265 trap[signo] = action;
11270 if (signo != 0) 11266 if (signo != 0)
11271 setsignal(signo); 11267 setsignal(signo);
diff --git a/shell/lash.c b/shell/lash.c
index 4ce6d4235..5ba490f2a 100644
--- a/shell/lash.c
+++ b/shell/lash.c
@@ -455,8 +455,7 @@ static void free_job(struct job *cmd)
455 for (i = 0; i < cmd->num_progs; i++) { 455 for (i = 0; i < cmd->num_progs; i++) {
456 free(cmd->progs[i].argv); 456 free(cmd->progs[i].argv);
457#if ENABLE_LASH_PIPE_N_REDIRECTS 457#if ENABLE_LASH_PIPE_N_REDIRECTS
458 if (cmd->progs[i].redirects) 458 free(cmd->progs[i].redirects);
459 free(cmd->progs[i].redirects);
460#endif 459#endif
461 } 460 }
462 free(cmd->progs); 461 free(cmd->progs);