Fix memory leaks in Doxygen to PyDoc parameter types conversion code.

Don't forget to delete the local copy of parameter list and the temporary
string.
This commit is contained in:
Vadim Zeitlin 2014-07-12 19:42:57 +02:00
commit 3db8c1fca2

View file

@ -239,12 +239,16 @@ PyDocConverter::PyDocConverter(int flags) :
std::string PyDocConverter::getParamType(std::string param) std::string PyDocConverter::getParamType(std::string param)
{ {
std::string type;
ParmList *plist = CopyParmList(Getattr(currentNode, "parms")); ParmList *plist = CopyParmList(Getattr(currentNode, "parms"));
Parm *p = NULL; Parm *p = NULL;
for (p = plist; p;) { for (p = plist; p;) {
if (Char (Getattr(p, "name")) == param) { if (Char (Getattr(p, "name")) == param) {
std::string type = Char (SwigType_str(Getattr(p, "type"), "")); String *s = SwigType_str(Getattr(p, "type"), "");
return type; type = Char (s);
Delete(s);
break;
} }
/* /*
* doesn't seem to work always: in some cases (especially for 'self' parameters) * doesn't seem to work always: in some cases (especially for 'self' parameters)
@ -254,7 +258,7 @@ std::string PyDocConverter::getParamType(std::string param)
p = nextSibling(p); p = nextSibling(p);
} }
Delete(plist); Delete(plist);
return ""; return type;
} }
std::string PyDocConverter::justifyString(std::string documentString, std::string PyDocConverter::justifyString(std::string documentString,