873ee852526ee64094fbc7ac2078820b7856c00e kent Wed May 4 17:20:12 2016 -0700 Adding function to free a whole list of cgiParsedVars. diff --git src/lib/cheapcgi.c src/lib/cheapcgi.c index 653275b..6256532 100644 --- src/lib/cheapcgi.c +++ src/lib/cheapcgi.c @@ -2348,30 +2348,43 @@ } void cgiParsedVarsFree(struct cgiParsedVars **pTags) /* Free up memory associated with cgiParsedVars */ { struct cgiParsedVars *tags = *pTags; if (tags != NULL) { slFreeList(&tags->list); hashFree(&tags->hash); freeMem(tags->stringBuf); freez(pTags); } } +void cgiParsedVarsFreeList(struct cgiParsedVars **pList) +/* Free up list of cgiParsedVars */ +{ +struct cgiParsedVars *el, *next; + +for (el = *pList; el != NULL; el = next) + { + next = el->next; + cgiParsedVarsFree(&el); + } +*pList = NULL; +} + void cgiEncodeHash(struct hash *hash, struct dyString *dy) /* Put a cgi-encoding of a string valued hash into dy. Tags are always * alphabetical to make it easier to compare if two hashes are same. */ { struct hashEl *el, *elList = hashElListHash(hash); slSort(&elList, hashElCmp); boolean firstTime = TRUE; char *s = NULL; for (el = elList; el != NULL; el = el->next) { if (firstTime) firstTime = FALSE; else dyStringAppendC(dy, '&'); dyStringAppend(dy, el->name);