diff options
author | TingPing <tingping@tingping.se> | 2014-12-28 06:08:20 -0500 |
---|---|---|
committer | TingPing <tingping@tingping.se> | 2014-12-28 06:47:07 -0500 |
commit | 3f855f07f5d2e9a08a586436719358c40a46f29d (patch) | |
tree | 12ffd1b49265e33c10149632a4cd17afb7fe994a /plugins/python | |
parent | 83032b1aa3c3e5910c5cfd3e0ea1d25827f56475 (diff) |
Use glib for allocations in all plugins
Continuation of 83032b1aa
Diffstat (limited to 'plugins/python')
-rw-r--r-- | plugins/python/python.c | 13 |
1 files changed, 3 insertions, 10 deletions
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; |