supress clang warning about vtable ptr overwrite.

Use calloc to zero memory just once.
Document memory leak.
This commit is contained in:
Mike Romberg 2017-07-01 17:38:48 -06:00
commit 74345c92e4

View file

@ -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;
}
}