Fix memory leak of getProxyName() return value

This is done not so much to fix the memory leak per se (as there are
gazillions of other ones remaining), but to show that the return value
of getProxyName() does need to be freed, as this was unclear previously,
with it being freed in one place where this function was used, but not
in the other one, here.

Also state this explicitly in the function comment.
This commit is contained in:
Vadim Zeitlin 2019-08-05 01:35:52 +02:00
commit ba564d4e4e

View file

@ -169,8 +169,7 @@ public:
* getProxyName()
*
* Test to see if a type corresponds to something wrapped with a proxy class.
* Return NULL if not otherwise the proxy class name, fully qualified with
* top level namespace name if the nspace feature is used.
* Return NULL if not, otherwise the proxy class name to be freed by the caller.
* ----------------------------------------------------------------------------- */
String *getProxyName(SwigType *t) {
@ -205,6 +204,7 @@ public:
}
if (proxyname) {
enumname = NewStringf("%s_%s", proxyname, symname);
Delete(proxyname);
} else {
// global enum or enum in a namespace
String *nspace = Getattr(n, "sym:nspace");