about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2016-07-25 21:56:38 +0100
committerJames Booth <boothj5@gmail.com>2016-07-25 21:56:38 +0100
commit943e91268c2489600ac1f28836fd0e24a0fd8dc2 (patch)
treea3e8bdba66089fff33598e5bc3d6de19f04de946 /src
parent139e53f388e06a91bebddbf144556db05ea61898 (diff)
downloadprofani-tty-943e91268c2489600ac1f28836fd0e24a0fd8dc2.tar.gz
Fix memory leaks
Diffstat (limited to 'src')
-rw-r--r--src/command/cmd_ac.c3
-rw-r--r--src/plugins/python_api.c4
2 files changed, 5 insertions, 2 deletions
diff --git a/src/command/cmd_ac.c b/src/command/cmd_ac.c
index afc642e4..6cb7b1a1 100644
--- a/src/command/cmd_ac.c
+++ b/src/command/cmd_ac.c
@@ -2640,9 +2640,9 @@ _join_autocomplete(ProfWin *window, const char *const input)
 
     if (result) {
         gboolean space_at_end = g_str_has_suffix(input, " ");
-        GString *beginning = g_string_new("/join");
         int num_args = g_strv_length(args);
         if ((num_args == 1 && space_at_end) || (num_args == 2 && !space_at_end)) {
+            GString *beginning = g_string_new("/join");
             g_string_append_printf(beginning, " %s", args[0]);
             found = autocomplete_param_with_ac(input, beginning->str, join_property_ac, TRUE);
             g_string_free(beginning, TRUE);
@@ -2652,6 +2652,7 @@ _join_autocomplete(ProfWin *window, const char *const input)
             }
         }
         if ((num_args == 3 && space_at_end) || (num_args == 4 && !space_at_end)) {
+            GString *beginning = g_string_new("/join");
             g_string_append_printf(beginning, " %s %s %s", args[0], args[1], args[2]);
             found = autocomplete_param_with_ac(input, beginning->str, join_property_ac, TRUE);
             g_string_free(beginning, TRUE);
diff --git a/src/plugins/python_api.c b/src/plugins/python_api.c
index 8309e5ec..ee8a874c 100644
--- a/src/plugins/python_api.c
+++ b/src/plugins/python_api.c
@@ -740,7 +740,9 @@ python_api_settings_get_string(PyObject *self, PyObject *args)
     disable_python_threads();
 
     if (res) {
-        return Py_BuildValue("s", res);
+        PyObject *pyres = Py_BuildValue("s", res);
+        free(res);
+        return pyres;
     } else {
         Py_RETURN_NONE;
     }