1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-09-22 19:45:54 -04:00

Fix memory leaks

This commit is contained in:
James Booth 2016-07-25 21:56:38 +01:00
parent 139e53f388
commit 943e91268c
2 changed files with 5 additions and 2 deletions

View File

@ -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);

View File

@ -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;
}