diff --git a/Source/Modules/allocate.cxx b/Source/Modules/allocate.cxx index b11b95e86..84597e8c5 100644 --- a/Source/Modules/allocate.cxx +++ b/Source/Modules/allocate.cxx @@ -370,6 +370,7 @@ class Allocate : public Dispatcher { Setattr(c,"feature:exceptionclass","1"); } p = nextSibling(p); + Delete(t); } } @@ -615,7 +616,7 @@ public: if (SwigType_check_decl(type,"p.")) { /* Need to check if type is a const pointer */ int isconst = 0; - SwigType_pop(type); + Delete(SwigType_pop(type)); if (SwigType_isconst(type)) { isconst = 1; Setattr(inclass,"allocate:smartpointerconst","1"); @@ -623,7 +624,6 @@ public: List *methods = smart_pointer_methods(sc,0,isconst); Setattr(inclass,"allocate:smartpointer",methods); Setattr(inclass,"allocate:smartpointerbase",base); - break; } else { /* Hmmm. The return value is not a pointer. If the type is a value or reference. We're going to chase it to see if another operator->() @@ -632,20 +632,17 @@ public: if ((SwigType_check_decl(type,"")) || (SwigType_check_decl(type,"r."))) { Node *nn = Swig_symbol_clookup((char*)"operator ->", Getattr(sc,"symtab")); if (nn) { + Delete(base); + Delete(type); sn = nn; continue; - } else { - break; } - } else { - break; } } - } else { - break; } - } else { - break; + Delete(base); + Delete(type); + break; } } } diff --git a/Source/Modules/lang.cxx b/Source/Modules/lang.cxx index 7f8ba656a..5a0859225 100644 --- a/Source/Modules/lang.cxx +++ b/Source/Modules/lang.cxx @@ -819,7 +819,9 @@ int Language::cDeclaration(Node *n) { Printf(f_header,"extern %s", SwigType_str(ty,name)); */ - Printf(f_header,"%s", SwigType_str(ty,name)); + String *str = SwigType_str(ty,name); + Printf(f_header,"%s", str); + Delete(str); { DOH *t = Getattr(n,"throws"); if (t) { @@ -835,14 +837,18 @@ int Language::cDeclaration(Node *n) { Printf(f_header,";\n"); } else if (Cmp(storage,"externc") == 0) { /* here 'extern "C"' is needed */ - Printf(f_header, "extern \"C\" %s;\n", SwigType_str(ty,name)); + String *str = SwigType_str(ty,name); + Printf(f_header, "extern \"C\" %s;\n", str); + Delete(str); } } } } /* This needs to check qualifiers */ if (SwigType_isqualifier(ty)) { - Setattr(n,"qualifier", SwigType_pop(ty)); + SwigType *qual = SwigType_pop(ty); + Setattr(n,"qualifier", qual); + Delete(qual); } Delete(SwigType_pop_function(ty)); DohIncref(type); @@ -861,7 +867,9 @@ int Language::cDeclaration(Node *n) { f_header = Swig_filebyname("header"); if (!NoExtern) { if (f_header) { - Printf(f_header,"extern %s;\n", SwigType_str(ty,name)); + String *str = SwigType_str(ty,name); + Printf(f_header,"extern %s;\n", str); + Delete(str); } } } @@ -875,6 +883,7 @@ int Language::cDeclaration(Node *n) { if (SwigType_isconst(tya)) { Setattr(n,"feature:immutable","1"); } + Delete(tya); } DohIncref(type); Setattr(n,"type",ty); @@ -1616,7 +1625,7 @@ int Language::unrollVirtualMethods(Node *n, SwigType *ty = NewString(Getattr(m,"type")); SwigType_push(ty,decl); if (SwigType_isqualifier(ty)) { - SwigType_pop(ty); + Delete(SwigType_pop(ty)); } Delete(SwigType_pop_function(ty)); Setattr(m,"returntype", ty); @@ -2404,8 +2413,9 @@ int Language::constantWrapper(Node *n) { String *name = Getattr(n,"sym:name"); SwigType *type = Getattr(n,"type"); String *value = Getattr(n,"value"); - - Printf(stdout,"constantWrapper : %s = %s\n", SwigType_str(type,name), value); + String *str = SwigType_str(type,name); + Printf(stdout,"constantWrapper : %s = %s\n", str, value); + Delete(str); return SWIG_OK; } @@ -2564,7 +2574,9 @@ Language::classLookup(SwigType *s) { if ((Len(prefix) == 0) || /* Simple type */ (Strcmp(prefix,"p.") == 0) || /* pointer */ (Strcmp(prefix,"r.") == 0)) { /* reference */ - Setattr(classtypes,Copy(s),n); + SwigType *cs = Copy(s); + Setattr(classtypes,cs,n); + Delete(cs); } else { n = 0; } @@ -2906,13 +2918,15 @@ int Language::is_assignable(Node *n) if ((Strcmp(nodeType(cn),"class") == 0)) { if (Getattr(cn,"allocate:noassign")) { Setattr(n,"feature:immutable","1"); + Delete(ftd); + Delete(td); return 0; - } else { - return 1; } } } } + Delete(ftd); + Delete(td); return 1; } diff --git a/Source/Modules/overload.cxx b/Source/Modules/overload.cxx index 6196a92b4..eede49130 100644 --- a/Source/Modules/overload.cxx +++ b/Source/Modules/overload.cxx @@ -194,10 +194,10 @@ Swig_overload_rank(Node *n, bool script_lang_wrapping) { String *dq1 = Copy(d1); String *dq2 = Copy(d2); if (SwigType_isconst(d1)) { - SwigType_pop(dq1); + Delete(SwigType_pop(dq1)); } if (SwigType_isconst(d2)) { - SwigType_pop(dq2); + Delete(SwigType_pop(dq2)); } if (Strcmp(dq1,dq2) == 0) { diff --git a/Source/Modules/python.cxx b/Source/Modules/python.cxx index 0493ccd3a..d1b2b15ce 100644 --- a/Source/Modules/python.cxx +++ b/Source/Modules/python.cxx @@ -1666,7 +1666,9 @@ public: /* Special hook for member pointer */ if (SwigType_type(type) == T_MPOINTER) { String *wname = Swig_name_wrapper(iname); - Printf(f_header, "static %s = %s;\n", SwigType_str(type,wname), value); + String *str = SwigType_str(type,wname); + Printf(f_header, "static %s = %s;\n", str, value); + Delete(str); value = wname; } if ((tm = Swig_typemap_lookup_new("consttab",n,name,0))) { @@ -2598,9 +2600,10 @@ int PYTHON::classDirectorMethod(Node *n, Node *parent, String *super) { Append(w->def, ", "); Append(declaration, ", "); } - - Printf(w->def, "%s", SwigType_str(Getattr(p, "type"),0)); - Printf(declaration, "%s", SwigType_str(Getattr(p, "type"),0)); + String *str = SwigType_str(Getattr(p, "type"),0); + Printf(w->def, "%s", str); + Printf(declaration, "%s", str); + Delete(str); } }