hush: small fix for unset -f on NOMMU.

Signed-off-by: root <root@localhost.localdomain>
This commit is contained in:
root 2009-05-04 12:00:19 +02:00
parent 62851171db
commit 6245202e7f

View File

@ -2924,13 +2924,13 @@ static void unset_func(const char *name)
while ((funcp = *funcpp) != NULL) { while ((funcp = *funcpp) != NULL) {
if (strcmp(funcp->name, name) == 0) { if (strcmp(funcp->name, name) == 0) {
*funcpp = funcp->next; *funcpp = funcp->next;
/* funcp is unlinked now, deleting it */ /* funcp is unlinked now, deleting it.
free(funcp->name); * Note: if !funcp->body, the function was created by
/* Note: if !funcp->body, do not free body_as_string! * "-F name body", do not free ->body_as_string
* This is a special case of "-F name body" function: * and ->name as they were not malloced. */
* body_as_string was not malloced! */
if (funcp->body) { if (funcp->body) {
free_pipe_list(funcp->body); free_pipe_list(funcp->body);
free(funcp->name);
# if !BB_MMU # if !BB_MMU
free(funcp->body_as_string); free(funcp->body_as_string);
# endif # endif