[Python] Fix potential memory leak in initialisation code for the generated
module. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11717 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
283fd3c7ec
commit
70e8072612
2 changed files with 13 additions and 9 deletions
|
|
@ -1,6 +1,10 @@
|
||||||
Version 1.3.41 (in progress)
|
Version 1.3.41 (in progress)
|
||||||
============================
|
============================
|
||||||
|
|
||||||
|
2009-11-02: olly
|
||||||
|
[Python] Fix potential memory leak in initialisation code for the
|
||||||
|
generated module.
|
||||||
|
|
||||||
2009-10-23: wsfulton
|
2009-10-23: wsfulton
|
||||||
Fix seg fault when using a named nested template instantiation using %template(name)
|
Fix seg fault when using a named nested template instantiation using %template(name)
|
||||||
within a class. A warning that these are not supported is now issued plus processing
|
within a class. A warning that these are not supported is now issued plus processing
|
||||||
|
|
|
||||||
|
|
@ -279,15 +279,15 @@ SWIG_Python_FixMethods(PyMethodDef *methods,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ci) {
|
if (ci) {
|
||||||
size_t shift = (ci->ptype) - types;
|
void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0;
|
||||||
swig_type_info *ty = types_initial[shift];
|
if (ptr) {
|
||||||
size_t ldoc = (c - methods[i].ml_doc);
|
size_t shift = (ci->ptype) - types;
|
||||||
size_t lptr = strlen(ty->name)+2*sizeof(void*)+2;
|
swig_type_info *ty = types_initial[shift];
|
||||||
char *ndoc = (char*)malloc(ldoc + lptr + 10);
|
size_t ldoc = (c - methods[i].ml_doc);
|
||||||
if (ndoc) {
|
size_t lptr = strlen(ty->name)+2*sizeof(void*)+2;
|
||||||
char *buff = ndoc;
|
char *ndoc = (char*)malloc(ldoc + lptr + 10);
|
||||||
void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0;
|
if (ndoc) {
|
||||||
if (ptr) {
|
char *buff = ndoc;
|
||||||
strncpy(buff, methods[i].ml_doc, ldoc);
|
strncpy(buff, methods[i].ml_doc, ldoc);
|
||||||
buff += ldoc;
|
buff += ldoc;
|
||||||
strncpy(buff, "swig_ptr: ", 10);
|
strncpy(buff, "swig_ptr: ", 10);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue