pidgin/pidgin

Fix some errors that scanbuild found
release-2.x.y
2021-06-03, Gary Kramlich
a4a68d315090
Parents f484a9317ad7
Children d10bb378f560
Fix some errors that scanbuild found

Testing Done:
Verified that scanbuild no longer detects the errors.

Reviewed at https://reviews.imfreedom.org/r/718/
--- a/libpurple/conversation.c Thu Jun 03 19:30:26 2021 -0500
+++ b/libpurple/conversation.c Thu Jun 03 19:31:56 2021 -0500
@@ -1852,7 +1852,7 @@
{
const char *display_name = purple_connection_get_display_name(gc);
if (display_name != NULL)
- alias = display_name;
+ new_alias = display_name;
}
}
} else {
--- a/libpurple/idle.c Thu Jun 03 19:30:26 2021 -0500
+++ b/libpurple/idle.c Thu Jun 03 19:31:56 2021 -0500
@@ -142,7 +142,6 @@
else
{
/* Don't report idle time */
- time_idle = 0;
report_idle = FALSE;
/* If we're not reporting idle, we can still do auto-away.
--- a/libpurple/log.c Thu Jun 03 19:30:26 2021 -0500
+++ b/libpurple/log.c Thu Jun 03 19:31:56 2021 -0500
@@ -1390,7 +1390,7 @@
data = log->logger_data;
/* if we can't write to the file, give up before we hurt ourselves */
- if(!data->file)
+ if(data == NULL || data->file == NULL)
return 0;
date = purple_date_format_full(localtime(&log->time));
@@ -1550,7 +1550,7 @@
data = log->logger_data;
/* if we can't write to the file, give up before we hurt ourselves */
- if(!data->file)
+ if(data == NULL || data->file == NULL)
return 0;
if (log->type == PURPLE_LOG_SYSTEM)
--- a/libpurple/mediamanager.c Thu Jun 03 19:30:26 2021 -0500
+++ b/libpurple/mediamanager.c Thu Jun 03 19:31:56 2021 -0500
@@ -726,8 +726,9 @@
GstIterator *iter;
#if GST_CHECK_VERSION(1,0,0)
GValue tmp = G_VALUE_INIT;
+#else
+ GstPad *remaining_pad;
#endif
- GstPad *remaining_pad;
GstIteratorResult result;
gst_element_release_request_pad(parent, pad);
@@ -746,7 +747,6 @@
gst_bin_remove(GST_BIN(GST_ELEMENT_PARENT(parent)), parent);
} else if (result == GST_ITERATOR_OK) {
#if GST_CHECK_VERSION(1,0,0)
- remaining_pad = g_value_get_object(&tmp);
g_value_reset(&tmp);
#else
gst_object_unref(remaining_pad);
--- a/libpurple/plugin.c Thu Jun 03 19:30:26 2021 -0500
+++ b/libpurple/plugin.c Thu Jun 03 19:31:56 2021 -0500
@@ -634,6 +634,13 @@
g_return_val_if_fail(plugin != NULL, FALSE);
g_return_val_if_fail(purple_plugin_is_loaded(plugin), FALSE);
+ if(plugin->info == NULL) {
+ purple_debug_error("plugin",
+ "Failed to unload plugin %s its info is NULL",
+ plugin->path);
+ return FALSE;
+ }
+
purple_debug_info("plugins", "Unloading plugin %s\n", plugin->info->name);
/* Unload all plugins that depend on this plugin. */
--- a/libpurple/plugins/log_reader.c Thu Jun 03 19:30:26 2021 -0500
+++ b/libpurple/plugins/log_reader.c Thu Jun 03 19:31:56 2021 -0500
@@ -1111,9 +1111,13 @@
}
msn_logger_parse_timestamp(message, &tm);
-
- timestamp = g_strdup_printf("<font size=\"2\">(%02u:%02u:%02u)</font> ",
- tm->tm_hour, tm->tm_min, tm->tm_sec);
+ if(tm != NULL) {
+ timestamp = g_strdup_printf("<font size=\"2\">(%02u:%02u:%02u)</font> ",
+ tm->tm_hour, tm->tm_min, tm->tm_sec);
+ } else {
+ timestamp = g_strdup_printf("<font size=\"2\">(00:00:00)</font> ");
+ }
+
text = g_string_append(text, timestamp);
g_free(timestamp);
@@ -2233,7 +2237,6 @@
log->logger = amsn_logger;
log->logger_data = data;
list = g_list_prepend(list, log);
- found_start = FALSE;
purple_debug_info("aMSN logger",
"Found log for %s:"