[Genome] memory leaks in cartCheckout

Adam Wenocur wenocur at genome.chop.edu
Sun May 6 20:21:12 PDT 2007


Hi all,

I was recently poking around the heap of the genome browser CGI  
executables, and I noticed some peculiarities.

Upon further inspection, I found that the cartCheckout function in  
kent/src/hg/lib/cart.c is the source of some memory leaks:

Instead of calling freeHash, cartCheckout should call  
freeHashAndVals, since the values loaded into the cart are cloned  
strings, and are otherwise orphaned.
There is the possibility that this solution might break the use of  
cart parameter strings that were not copied prior to checking out the  
cart, however it seems not to have caused any ill effect on my genome  
browser mirror.

A second issue doesn't appear to be causing leaks, but may have the  
potential to: cartCheckout should use cartDbFreeList instead  
cartDbFree, since userInfo and sessionInfo are indirectly assigned by  
cartDbLoadWhere in cartNew, and could point to linked lists.

I'm aware that this isn't of great importance to the CGI binaries,  
since cartCheckout  is usually called shortly before a program exits,  
but I figure it couldn't hurt to note my observations.

-Adam


More information about the Genome mailing list