more memory leaks fixes
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@7921 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
7703b99b53
commit
34e0da0d4d
11 changed files with 112 additions and 94 deletions
|
|
@ -364,7 +364,6 @@ SwigType *SwigType_default(SwigType *t) {
|
|||
|
||||
r = Getattr(default_cache,t);
|
||||
if (r) {
|
||||
if (Strcmp(r,t) == 0) return 0;
|
||||
return Copy(r);
|
||||
}
|
||||
#endif
|
||||
|
|
@ -467,17 +466,20 @@ SwigType *SwigType_default(SwigType *t) {
|
|||
def = NewString("SWIGTYPE");
|
||||
}
|
||||
if (r != t) Delete(r);
|
||||
#ifdef SWIG_DEFAULT_CACHE
|
||||
/* The cache produces strange results, see enum_template.i case */
|
||||
cdef = Copy(def);
|
||||
Setattr(default_cache,t, cdef);
|
||||
Delete(cdef);
|
||||
#endif
|
||||
if (StringEqual(def,t)) {
|
||||
Delete(def);
|
||||
def = 0;
|
||||
}
|
||||
|
||||
#ifdef SWIG_DEFAULT_CACHE
|
||||
/* The cache produces strange results, see enum_template.i case */
|
||||
if (def) {
|
||||
cdef = Copy(def);
|
||||
Setattr(default_cache,t, cdef);
|
||||
Delete(cdef);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Printf(stderr,"type : def %s : %s\n", t, def); */
|
||||
|
||||
return def;
|
||||
|
|
|
|||
|
|
@ -1111,10 +1111,12 @@ static void typemap_locals(DOHString *s, ParmList *l, Wrapper *f, int argnum) {
|
|||
if ((argnum >= 0) && (!isglobal)) {
|
||||
Printf(str,"%s%d",pn,argnum);
|
||||
} else {
|
||||
Printf(str,"%s",pn);
|
||||
StringAppend(str,pn);
|
||||
}
|
||||
if (isglobal && Wrapper_check_local(f,str)) {
|
||||
p = nextSibling(p);
|
||||
Delete(str);
|
||||
if (at) Delete(at);
|
||||
continue;
|
||||
}
|
||||
if (value) {
|
||||
|
|
@ -1134,7 +1136,7 @@ static void typemap_locals(DOHString *s, ParmList *l, Wrapper *f, int argnum) {
|
|||
}
|
||||
}
|
||||
p = nextSibling(p);
|
||||
Delete(at);
|
||||
if (at) Delete(at);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1156,7 +1158,11 @@ String *Swig_typemap_lookup(const String_or_char *op, SwigType *type, String_or_
|
|||
if (!tm) return 0;
|
||||
|
||||
s = Getattr(tm,k_code);
|
||||
if (!s) return 0;
|
||||
if (!s) {
|
||||
if (mtype) Delete(mtype);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* Blocked */
|
||||
if (Cmp(s,"pass") == 0) {
|
||||
|
|
@ -1342,7 +1348,7 @@ Printf(stdout, "Swig_typemap_lookup %s [%s %s]\n", op, type, pname ? pname : "NO
|
|||
if (type) {
|
||||
SwigType *rtype = SwigType_typedef_resolve_all(type);
|
||||
String *mangle = Swig_string_mangle(rtype);
|
||||
Printf(value,"%s",mangle);
|
||||
StringAppend(value,mangle);
|
||||
Delete(mangle);
|
||||
Delete(rtype);
|
||||
}
|
||||
|
|
@ -1678,6 +1684,8 @@ static void replace_embedded_typemap(String *s) {
|
|||
Insert(n,0,"$");
|
||||
Setattr(vars,n,v);
|
||||
}
|
||||
Delete(n);
|
||||
Delete(v);
|
||||
}
|
||||
|
||||
method = Getitem(l,0);
|
||||
|
|
|
|||
|
|
@ -292,6 +292,7 @@ SwigType_inherit_scope(Typetab *scope) {
|
|||
if (!inherits) {
|
||||
inherits = NewList();
|
||||
Setattr(current_scope,k_inherit, inherits);
|
||||
Delete(inherits);
|
||||
}
|
||||
assert(scope != current_scope);
|
||||
|
||||
|
|
@ -338,6 +339,7 @@ SwigType_using_scope(Typetab *scope) {
|
|||
if (!ulist) {
|
||||
ulist = NewList();
|
||||
Setattr(current_scope,k_using, ulist);
|
||||
Delete(ulist);
|
||||
}
|
||||
assert(scope != current_scope);
|
||||
len = Len(ulist);
|
||||
|
|
@ -1645,6 +1647,7 @@ SwigType_inherit(String *derived, String *base, String *cast) {
|
|||
if (!h) {
|
||||
h = NewHash();
|
||||
Setattr(subclass,base,h);
|
||||
Delete(h);
|
||||
}
|
||||
if (!Getattr(h,derived)) {
|
||||
Setattr(h,derived, cast ? cast : (void *) "");
|
||||
|
|
@ -1789,6 +1792,7 @@ void SwigType_inherit_equiv(File *out) {
|
|||
bk = Next(bk);
|
||||
}
|
||||
rk = Next(rk);
|
||||
Delete(rlist);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -83,7 +83,6 @@ Wrapper_pretty_print(String *str, File *f) {
|
|||
|
||||
ts = NewStringEmpty();
|
||||
Seek(str,0, SEEK_SET);
|
||||
Clear(ts);
|
||||
while ((c = Getc(str)) != EOF) {
|
||||
if (c == '\"') {
|
||||
Putc(c,ts);
|
||||
|
|
@ -222,8 +221,6 @@ Wrapper_compact_print(String *str, File *f) {
|
|||
ts = NewStringEmpty();
|
||||
tf = NewStringEmpty();
|
||||
Seek(str,0, SEEK_SET);
|
||||
Clear(ts);
|
||||
Clear(tf);
|
||||
|
||||
while ((c = Getc(str)) != EOF) {
|
||||
if (c == '\"') { /* string 1 */
|
||||
|
|
@ -263,7 +260,7 @@ Wrapper_compact_print(String *str, File *f) {
|
|||
for (i = 0; i < level; i++)
|
||||
Putc(' ',tf);
|
||||
}
|
||||
Printf(tf,"%s",ts);
|
||||
Append(tf,ts);
|
||||
Clear(ts);
|
||||
level+=indent;
|
||||
while ((c = Getc(str)) != EOF) {
|
||||
|
|
@ -286,7 +283,7 @@ Wrapper_compact_print(String *str, File *f) {
|
|||
for (i = 0; i < level; i++)
|
||||
Putc(' ',tf);
|
||||
}
|
||||
Printf(tf, "%s", ts);
|
||||
Append(tf, ts);
|
||||
Putc(c, tf);
|
||||
Clear(ts);
|
||||
level-=indent;
|
||||
|
|
@ -312,7 +309,7 @@ Wrapper_compact_print(String *str, File *f) {
|
|||
for (i = 0; i < level; i++)
|
||||
Putc(' ',tf);
|
||||
}
|
||||
Printf(tf,"%s",ts);
|
||||
Append(tf,ts);
|
||||
Clear(ts);
|
||||
}
|
||||
Ungetc(c,str);
|
||||
|
|
@ -356,9 +353,9 @@ Wrapper_compact_print(String *str, File *f) {
|
|||
break;
|
||||
}
|
||||
if (!empty) {
|
||||
Printf(tf,"\n");
|
||||
Append(tf,"\n");
|
||||
}
|
||||
Printf(tf,"%s",ts);
|
||||
Append(tf,ts);
|
||||
Printf(f, "%s", tf);
|
||||
Clear(tf);
|
||||
Clear(ts);
|
||||
|
|
@ -373,7 +370,7 @@ Wrapper_compact_print(String *str, File *f) {
|
|||
}
|
||||
}
|
||||
if (!empty) {
|
||||
Printf(tf,"%s",ts);
|
||||
Append(tf,ts);
|
||||
}
|
||||
if (Len(tf) != 0)
|
||||
Printf(f,"%s",tf);
|
||||
|
|
@ -400,6 +397,8 @@ Wrapper_print(Wrapper *w, File *f) {
|
|||
Wrapper_compact_print(str,f);
|
||||
else
|
||||
Wrapper_pretty_print(str,f);
|
||||
|
||||
Delete(str);
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue