Several parts of the code use talloc_tos() requiring a stackframe to be
present. This is needed as loadparm_init_s3() will call init_globals()
later.
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
PyObject *py_loadparm;
const struct loadparm_s3_helpers *s3_context;
const struct loadparm_context *s4_context;
- TALLOC_CTX *mem_ctx;
-
- mem_ctx = talloc_new(NULL);
- if (mem_ctx == NULL) {
- PyErr_NoMemory();
- return NULL;
- }
+ TALLOC_CTX *frame = talloc_stackframe();
s3_context = loadparm_s3_helpers();
- s4_context = loadparm_init_s3(mem_ctx, s3_context);
+ s4_context = loadparm_init_s3(frame, s3_context);
if (s4_context == NULL) {
+ talloc_free(frame);
PyErr_NoMemory();
return NULL;
}
py_loadparm = pytalloc_steal(loadparm_Type, discard_const_p(struct loadparm_context, s4_context));
if (py_loadparm == NULL) {
- talloc_free(mem_ctx);
+ talloc_free(frame);
PyErr_NoMemory();
return NULL;
}
- talloc_free(mem_ctx);
+ talloc_free(frame);
return py_loadparm;
}