Commit 28b48c06 authored by Jeremy White's avatar Jeremy White

Be a little more surgical in when we choose to free.

parent b85bfffb
......@@ -58,7 +58,8 @@ static gchar * string_option(GKeyFile *u, GKeyFile *s, const gchar *section, con
ret = g_key_file_get_string(u, section, key, &error);
if ((! u || error) && s)
ret = g_key_file_get_string(s, section, key, NULL);
g_error_free(error);
if (error)
g_error_free(error);
return ret;
}
......@@ -72,7 +73,8 @@ static gint int_option(GKeyFile *u, GKeyFile *s, const gchar *section, const gch
ret = g_key_file_get_integer(u, section, key, &error);
if ((! u || error) && s)
ret = g_key_file_get_integer(s, section, key, NULL);
g_error_free(error);
if (error)
g_error_free(error);
return ret;
}
......@@ -86,7 +88,8 @@ static gboolean bool_option(GKeyFile *u, GKeyFile *s, const gchar *section, cons
ret = g_key_file_get_boolean(u, section, key, &error);
if ((! u || error) && s)
ret = g_key_file_get_boolean(s, section, key, NULL);
g_error_free(error);
if (error)
g_error_free(error);
return ret;
}
......@@ -186,8 +189,10 @@ void options_from_config(options_t *options)
options->exit_on_disconnect = bool_option(userkey, systemkey, "spice", "exit_on_disconnect");
g_free(user_config_file);
g_key_file_free(systemkey);
g_key_file_free(userkey);
if (systemkey)
g_key_file_free(systemkey);
if (userkey)
g_key_file_free(userkey);
g_debug("options addr '%s', disable_ticketing %d, port %d", options->spice_addr, options->disable_ticketing, options->spice_port);
}
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