mirror of https://github.com/swig/swig
[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
|
@ -1,6 +1,10 @@
|
|||
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
|
||||
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
|
||||
|
|
|
@ -279,15 +279,15 @@ SWIG_Python_FixMethods(PyMethodDef *methods,
|
|||
}
|
||||
}
|
||||
if (ci) {
|
||||
size_t shift = (ci->ptype) - types;
|
||||
swig_type_info *ty = types_initial[shift];
|
||||
size_t ldoc = (c - methods[i].ml_doc);
|
||||
size_t lptr = strlen(ty->name)+2*sizeof(void*)+2;
|
||||
char *ndoc = (char*)malloc(ldoc + lptr + 10);
|
||||
if (ndoc) {
|
||||
char *buff = ndoc;
|
||||
void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0;
|
||||
if (ptr) {
|
||||
void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0;
|
||||
if (ptr) {
|
||||
size_t shift = (ci->ptype) - types;
|
||||
swig_type_info *ty = types_initial[shift];
|
||||
size_t ldoc = (c - methods[i].ml_doc);
|
||||
size_t lptr = strlen(ty->name)+2*sizeof(void*)+2;
|
||||
char *ndoc = (char*)malloc(ldoc + lptr + 10);
|
||||
if (ndoc) {
|
||||
char *buff = ndoc;
|
||||
strncpy(buff, methods[i].ml_doc, ldoc);
|
||||
buff += ldoc;
|
||||
strncpy(buff, "swig_ptr: ", 10);
|
||||
|
|
Loading…
Reference in New Issue