grim/testing

Fix some double frees that scanbuild found
release-2.x.y
2021-06-01, Gary Kramlich
3e498730f8ca
Parents 793a6c2732d0
Children c354aa148fd5
Fix some double frees that scanbuild found

Testing Done:
Verified scanbuild no longer detected the errors.

Reviewed at https://reviews.imfreedom.org/r/708/
--- a/pidgin/gtkft.c Tue Jun 01 20:22:06 2021 -0500
+++ b/pidgin/gtkft.c Tue Jun 01 22:18:49 2021 -0500
@@ -483,7 +483,6 @@
#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 @@
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 @@
char *secondary = g_strdup_printf(_("Process returned error code %d"),
exit_status);
purple_notify_error(dialog, NULL, primary, secondary);
- g_free(tmp);
}
}
#endif
--- a/pidgin/gtkutils.c Tue Jun 01 20:22:06 2021 -0500
+++ b/pidgin/gtkutils.c Tue Jun 01 22:18:49 2021 -0500
@@ -3245,7 +3245,6 @@
}
#else
char *command = NULL;
- char *tmp = NULL;
GError *error = NULL;
if (purple_running_gnome())
@@ -3275,8 +3274,8 @@
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 @@
char *secondary = g_strdup_printf(_("Process returned error code %d"),
exit_status);
purple_notify_error(imhtml, NULL, primary, secondary);
- g_free(tmp);
}
}
#endif