pidgin/pidgin

Fix a potential memory leak scanbuild identified
release-2.x.y
2021-06-01, Gary Kramlich
c354aa148fd5
Parents 3e498730f8ca
Children ad5beb40c3fe
Fix a potential memory leak scanbuild identified

Testing Done:
Verified scanbuild no longer detected the error.

Reviewed at https://reviews.imfreedom.org/r/709/
--- a/libpurple/plugins/offlinemsg.c Tue Jun 01 22:18:49 2021 -0500
+++ b/libpurple/plugins/offlinemsg.c Tue Jun 01 22:19:45 2021 -0500
@@ -148,10 +148,9 @@
offline->message = *message;
*message = NULL;
- if (purple_prefs_get_bool(PREF_ALWAYS) || setting == OFFLINE_MSG_YES)
+ if (purple_prefs_get_bool(PREF_ALWAYS) || setting == OFFLINE_MSG_YES) {
record_pounce(offline);
- else if (setting == OFFLINE_MSG_NONE)
- {
+ } else if (setting == OFFLINE_MSG_NONE) {
char *ask;
ask = g_strdup_printf(_("\"%s\" is currently offline. Do you want to save the "
"rest of the messages in a pounce and automatically send them "
@@ -165,6 +164,8 @@
_("Yes"), record_pounce,
_("No"), cancel_poune);
g_free(ask);
+ } else {
+ discard_data(offline);
}
}