mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-19 22:36:22 +00:00
Fix GError handling
Several users have reported segfaults when starting up profanity which has OMEMO support, but OMEMO is not set up yet. @StefanKropp has been able to reproduce this and tracked it down to `_load_identity()` calling `omemo_known_devices_keyfile_save()`. The latter then calls `save_keyfile()` which calls `g_key_file_save_to_file()`. This can then fail if one of the first two strings is NULL and won't set the `error` on return. In its error handling `save_keyfile()` unconditionally dereferences `error` which leads to the segfault. Fix this and also go through the entire codebase and verify that the usage of `GError` is done correctly. Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
This commit is contained in:
@@ -214,10 +214,8 @@ plugins_uninstall(const char* const plugin_name)
|
||||
g_string_append(target_path, "/");
|
||||
g_string_append(target_path, plugin_name);
|
||||
GFile* file = g_file_new_for_path(target_path->str);
|
||||
GError* error = NULL;
|
||||
gboolean result = g_file_delete(file, NULL, &error);
|
||||
gboolean result = g_file_delete(file, NULL, NULL);
|
||||
g_object_unref(file);
|
||||
g_error_free(error);
|
||||
g_string_free(target_path, TRUE);
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user