From d5ceec6e8b3071eec6a91c6efe0a439206f62a88 Mon Sep 17 00:00:00 2001 From: Aaron Griffith Date: Sun, 19 Jun 2011 13:50:55 -0400 Subject: [PATCH] fixed custom mode option inheritance bug + another bug Render mode "self" structs are now guaranteed to start zero'd out. --- src/rendermodes.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/rendermodes.c b/src/rendermodes.c index 717273c..ed02a55 100644 --- a/src/rendermodes.c +++ b/src/rendermodes.c @@ -66,7 +66,7 @@ render_mode_create_options(const char *mode) { } /* check custom mode info if needed */ - if (found_concrete == 1 && custom_render_modes != NULL) { + if (found_concrete == 0 && custom_render_modes != NULL) { PyObject *custom = PyDict_GetItemString(custom_render_modes, mode); if (custom) { custom = PyDict_GetItemString(custom, "parent"); @@ -134,13 +134,13 @@ RenderMode *render_mode_create(const char *mode, RenderState *state) { if (options == NULL) return NULL; - ret = malloc(sizeof(RenderMode)); + ret = calloc(1, sizeof(RenderMode)); if (ret == NULL) { Py_DECREF(options); return NULL; } - ret->mode = malloc(iface->data_size); + ret->mode = calloc(1, iface->data_size); if (ret->mode == NULL) { Py_DECREF(options); free(ret);