0

fixed custom mode option inheritance bug + another bug

Render mode "self" structs are now guaranteed to start zero'd out.
This commit is contained in:
Aaron Griffith
2011-06-19 13:50:55 -04:00
parent 7e5f518958
commit d5ceec6e8b

View File

@@ -66,7 +66,7 @@ render_mode_create_options(const char *mode) {
} }
/* check custom mode info if needed */ /* 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); PyObject *custom = PyDict_GetItemString(custom_render_modes, mode);
if (custom) { if (custom) {
custom = PyDict_GetItemString(custom, "parent"); custom = PyDict_GetItemString(custom, "parent");
@@ -134,13 +134,13 @@ RenderMode *render_mode_create(const char *mode, RenderState *state) {
if (options == NULL) if (options == NULL)
return NULL; return NULL;
ret = malloc(sizeof(RenderMode)); ret = calloc(1, sizeof(RenderMode));
if (ret == NULL) { if (ret == NULL) {
Py_DECREF(options); Py_DECREF(options);
return NULL; return NULL;
} }
ret->mode = malloc(iface->data_size); ret->mode = calloc(1, iface->data_size);
if (ret->mode == NULL) { if (ret->mode == NULL) {
Py_DECREF(options); Py_DECREF(options);
free(ret); free(ret);