--- libaitwww/src/aitwww.c 2012/03/09 09:38:55 1.1.1.1.2.1 +++ libaitwww/src/aitwww.c 2012/03/09 10:03:21 1.1.1.1.2.2 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: aitwww.c,v 1.1.1.1.2.1 2012/03/09 09:38:55 misho Exp $ +* $Id: aitwww.c,v 1.1.1.1.2.2 2012/03/09 10:03:21 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -324,7 +324,7 @@ www_addValue(cgi_t * __restrict cgi, const char *name, int www_delPair(cgi_t * __restrict cgi, const char *name) { - struct tagCGI *t; + struct tagCGI *t, *tmp; if (!cgi || !name) { www_SetErr(EINVAL, "Invalid argument(s)"); @@ -332,9 +332,15 @@ www_delPair(cgi_t * __restrict cgi, const char *name) } /* search for delete */ - SLIST_FOREACH(t, cgi, cgi_node) + SLIST_FOREACH_SAFE(t, cgi, cgi_node, tmp) if (t->cgi_name && !strcmp(name, t->cgi_name)) { SLIST_REMOVE(cgi, t, tagCGI, cgi_node); + + if (t->cgi_name) + free(t->cgi_name); + if (t->cgi_value) + free(t->cgi_value); + free(t); return 1; }