supress clang warning about vtable ptr overwrite.
Use calloc to zero memory just once. Document memory leak.
This commit is contained in:
parent
251d25346d
commit
74345c92e4
1 changed files with 1 additions and 2 deletions
|
|
@ -135,12 +135,11 @@ namespace swig {
|
|||
}
|
||||
} else {
|
||||
// Uninitialized return value, no Type() constructor required.
|
||||
static Type *v_def = (Type*) malloc(sizeof(Type));
|
||||
static Type *v_def = (Type*) calloc(1, sizeof(Type)); // memory leak?
|
||||
if (!PyErr_Occurred()) {
|
||||
%type_error(swig::type_name<Type>());
|
||||
}
|
||||
if (throw_error) throw std::invalid_argument("bad type");
|
||||
memset(v_def,0,sizeof(Type));
|
||||
return *v_def;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue