Commit ddc29426 authored by spiiroin's avatar spiiroin

[dbus] Fix free() vs g_free() issues

The get_hidden_modes() returns data allocated via g_key_file_get_string()
which should be released with g_free() and fallback uses strdup() which
should use free().

Use g_strdup() in the fallback case and release memory with g_free().
Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
parent 2abea953
......@@ -248,10 +248,10 @@ error_reply:
{
char *config = get_hidden_modes();
if(!config)
config = strdup("");
config = g_strdup("");
if((reply = dbus_message_new_method_return(msg)))
dbus_message_append_args (reply, DBUS_TYPE_STRING, &config, DBUS_TYPE_INVALID);
free(config);
g_free(config);
}
else if(!strcmp(member, USB_MODE_NETWORK_SET))
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment