summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGary Kramlich <grim@reaperworld.com>2021-06-01 22:18:49 -0500
committerGary Kramlich <grim@reaperworld.com>2021-06-01 22:18:49 -0500
commit6b78f0f4563c732b798424419f308f3f33ad5cc8 (patch)
tree2fc87c73ef7cb66db3cc49a614d17ef66c0063d2
parent5162ca2fc010d70fdbe21e6d52a15c8951de4ab9 (diff)
downloadpidgin-6b78f0f4563c732b798424419f308f3f33ad5cc8.tar.gz
Fix some double frees that scanbuild found
Testing Done: Verified scanbuild no longer detected the errors. Reviewed at https://reviews.imfreedom.org/r/708/
-rw-r--r--pidgin/gtkft.c8
-rw-r--r--pidgin/gtkutils.c6
2 files changed, 5 insertions, 9 deletions
diff --git a/pidgin/gtkft.c b/pidgin/gtkft.c
index e67ad7b598..eeb67e3b2a 100644
--- a/pidgin/gtkft.c
+++ b/pidgin/gtkft.c
@@ -483,7 +483,6 @@ open_button_cb(GtkButton *button, PidginXferDialog *dialog)
#else
const char *filename = purple_xfer_get_local_filename(dialog->selected_xfer);
char *command = NULL;
- char *tmp = NULL;
GError *error = NULL;
if (purple_running_gnome())
@@ -515,9 +514,9 @@ open_button_cb(GtkButton *button, PidginXferDialog *dialog)
gint exit_status;
if (!g_spawn_command_line_sync(command, NULL, NULL, &exit_status, &error))
{
- tmp = g_strdup_printf(_("Error launching %s: %s"),
- purple_xfer_get_local_filename(dialog->selected_xfer),
- error->message);
+ gchar *tmp = g_strdup_printf(_("Error launching %s: %s"),
+ purple_xfer_get_local_filename(dialog->selected_xfer),
+ error->message);
purple_notify_error(dialog, NULL, _("Unable to open file."), tmp);
g_free(tmp);
g_error_free(error);
@@ -528,7 +527,6 @@ open_button_cb(GtkButton *button, PidginXferDialog *dialog)
char *secondary = g_strdup_printf(_("Process returned error code %d"),
exit_status);
purple_notify_error(dialog, NULL, primary, secondary);
- g_free(tmp);
}
}
#endif
diff --git a/pidgin/gtkutils.c b/pidgin/gtkutils.c
index 8a60983405..d8b4c5b188 100644
--- a/pidgin/gtkutils.c
+++ b/pidgin/gtkutils.c
@@ -3245,7 +3245,6 @@ open_file(GtkIMHtml *imhtml, const char *filename)
}
#else
char *command = NULL;
- char *tmp = NULL;
GError *error = NULL;
if (purple_running_gnome())
@@ -3275,8 +3274,8 @@ open_file(GtkIMHtml *imhtml, const char *filename)
gint exit_status;
if (!g_spawn_command_line_sync(command, NULL, NULL, &exit_status, &error))
{
- tmp = g_strdup_printf(_("Error launching %s: %s"),
- filename, error->message);
+ gchar *tmp = g_strdup_printf(_("Error launching %s: %s"),
+ filename, error->message);
purple_notify_error(imhtml, NULL, _("Unable to open file."), tmp);
g_free(tmp);
g_error_free(error);
@@ -3287,7 +3286,6 @@ open_file(GtkIMHtml *imhtml, const char *filename)
char *secondary = g_strdup_printf(_("Process returned error code %d"),
exit_status);
purple_notify_error(imhtml, NULL, primary, secondary);
- g_free(tmp);
}
}
#endif