fix "if (p) free(p)" constructs
This commit is contained in:
parent
e918e155ed
commit
6081868ee3
@ -157,7 +157,7 @@ static void sed_free_and_close_stuff(void)
|
|||||||
sed_cmd = sed_cmd_next;
|
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)
|
while (G.current_input_file < G.input_file_count)
|
||||||
fclose(G.input_file_list[G.current_input_file++]);
|
fclose(G.input_file_list[G.current_input_file++]);
|
||||||
|
12
shell/ash.c
12
shell/ash.c
@ -5328,8 +5328,7 @@ expbackq(union node *cmd, int quoted, int quotes)
|
|||||||
p = buf;
|
p = buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in.buf)
|
free(in.buf);
|
||||||
free(in.buf);
|
|
||||||
if (in.fd >= 0) {
|
if (in.fd >= 0) {
|
||||||
close(in.fd);
|
close(in.fd);
|
||||||
back_exitstatus = waitforjob(in.jp);
|
back_exitstatus = waitforjob(in.jp);
|
||||||
@ -8788,8 +8787,7 @@ popfile(void)
|
|||||||
INT_OFF;
|
INT_OFF;
|
||||||
if (pf->fd >= 0)
|
if (pf->fd >= 0)
|
||||||
close(pf->fd);
|
close(pf->fd);
|
||||||
if (pf->buf)
|
free(pf->buf);
|
||||||
free(pf->buf);
|
|
||||||
while (pf->strpush)
|
while (pf->strpush)
|
||||||
popstring();
|
popstring();
|
||||||
parsefile = pf->prev;
|
parsefile = pf->prev;
|
||||||
@ -10330,8 +10328,7 @@ parsebackq: {
|
|||||||
#endif
|
#endif
|
||||||
savepbq = parsebackquote;
|
savepbq = parsebackquote;
|
||||||
if (setjmp(jmploc.loc)) {
|
if (setjmp(jmploc.loc)) {
|
||||||
if (str)
|
free(str);
|
||||||
free(str);
|
|
||||||
parsebackquote = 0;
|
parsebackquote = 0;
|
||||||
exception_handler = savehandler;
|
exception_handler = savehandler;
|
||||||
longjmp(exception_handler->loc, 1);
|
longjmp(exception_handler->loc, 1);
|
||||||
@ -11264,8 +11261,7 @@ trapcmd(int argc, char **argv)
|
|||||||
else
|
else
|
||||||
action = ckstrdup(action);
|
action = ckstrdup(action);
|
||||||
}
|
}
|
||||||
if (trap[signo])
|
free(trap[signo]);
|
||||||
free(trap[signo]);
|
|
||||||
trap[signo] = action;
|
trap[signo] = action;
|
||||||
if (signo != 0)
|
if (signo != 0)
|
||||||
setsignal(signo);
|
setsignal(signo);
|
||||||
|
@ -455,8 +455,7 @@ static void free_job(struct job *cmd)
|
|||||||
for (i = 0; i < cmd->num_progs; i++) {
|
for (i = 0; i < cmd->num_progs; i++) {
|
||||||
free(cmd->progs[i].argv);
|
free(cmd->progs[i].argv);
|
||||||
#if ENABLE_LASH_PIPE_N_REDIRECTS
|
#if ENABLE_LASH_PIPE_N_REDIRECTS
|
||||||
if (cmd->progs[i].redirects)
|
free(cmd->progs[i].redirects);
|
||||||
free(cmd->progs[i].redirects);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
free(cmd->progs);
|
free(cmd->progs);
|
||||||
|
Loading…
Reference in New Issue
Block a user