From 3f855f07f5d2e9a08a586436719358c40a46f29d Mon Sep 17 00:00:00 2001 From: TingPing Date: Sun, 28 Dec 2014 06:08:20 -0500 Subject: Use glib for allocations in all plugins Continuation of 83032b1aa --- plugins/python/python.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'plugins/python') diff --git a/plugins/python/python.c b/plugins/python/python.c index f0e4aa72..903b2bed 100644 --- a/plugins/python/python.c +++ b/plugins/python/python.c @@ -1407,11 +1407,7 @@ static Hook * Plugin_AddHook(int type, PyObject *plugin, PyObject *callback, PyObject *userdata, char *name, void *data) { - Hook *hook = (Hook *) g_malloc(sizeof(Hook)); - if (hook == NULL) { - PyErr_NoMemory(); - return NULL; - } + Hook *hook = g_new(Hook, 1); hook->type = type; hook->plugin = plugin; Py_INCREF(callback); @@ -2532,11 +2528,8 @@ IInterp_Exec(char *command) } d = PyModule_GetDict(m); len = strlen(command); - buffer = (char *) g_malloc(len+2); - if (buffer == NULL) { - hexchat_print(ph, "Not enough memory for command buffer"); - goto fail; - } + + buffer = g_malloc(len + 2); memcpy(buffer, command, len); buffer[len] = '\n'; buffer[len+1] = 0; -- cgit 1.4.1