1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-06-23 21:45:30 +00:00

Merge pull request #1313 from profanity-im/memleaks

Free GError objects
This commit is contained in:
Michael Vetter 2020-04-14 09:40:51 +02:00 committed by GitHub
commit 00cf4e6f41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View File

@ -114,6 +114,8 @@ copy_file(const char *const sourcepath, const char *const targetpath, const gboo
GError *error = NULL;
GFileCopyFlags flags = overwrite_existing ? G_FILE_COPY_OVERWRITE : G_FILE_COPY_NONE;
gboolean success = g_file_copy (source, dest, flags, NULL, NULL, NULL, &error);
if (error != NULL)
g_error_free(error);
g_object_unref(source);
g_object_unref(dest);
return success;

View File

@ -224,9 +224,10 @@ notify(const char *const message, int timeout, const char *const category)
log_error("Error sending desktop notification:");
log_error(" -> Message : %s", message);
log_error(" -> Error : %s", error->message);
g_error_free(error);
} else {
log_debug("Notification sent.");
}
log_debug("Notification sent.");
}
} else {
log_error("Libnotify not initialised.");
}