[OPEN-ILS-DEV] osrf_json_xml.c: memory leak and apparent bug
Scott McKellar
mck9 at swbell.net
Sun Jan 27 12:49:06 EST 2008
At the end of startElementHandler(), there is a branch of code that
runs when the name passed in is "boolean". It constructs a jsonObject
of type JSON_BOOL but doesn't do anything with it. The pointer goes
out of scope and the memory leaks.
As a result, this branch of logic has no effect at all, except to
leak memory.
I would have expected a call to appendChild(), and probably to
osrfListPush() as well. However the other branches are not completely
consistent in this regard -- for "null" we create a jsonObject and
pass it to appendChild(), but we don't call osrfListPush() for it.
Another option is to remove this branch altogether. The resulting
code would behave exactly the same as it does now, but without
leaking.
Not sure of how to proceed, I leave this decision to my betters.
Scott McKellar
http://home.swbell.net/mck9/ct/
More information about the Open-ils-dev
mailing list