pidgin/pidgin

Fix some issues scanbuild found in zephyr
release-2.x.y
2021-06-02, Gary Kramlich
cfababca6bf1
Parents a0e7e3b8e834
Children 128a40bc6e88
Fix some issues scanbuild found in zephyr

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

Reviewed at https://reviews.imfreedom.org/r/707/
--- a/libpurple/protocols/zephyr/zephyr.c Wed Jun 02 03:00:49 2021 -0500
+++ b/libpurple/protocols/zephyr/zephyr.c Wed Jun 02 04:11:03 2021 -0500
@@ -739,8 +739,8 @@
for (curr = zephyr->pending_zloc_names; curr != NULL; curr = curr->next) {
char* normalized_who = local_zephyr_normalize(zephyr,who);
if (!g_ascii_strcasecmp(normalized_who, (char *)curr->data)) {
- g_free((char *)curr->data);
- zephyr->pending_zloc_names = g_list_remove(zephyr->pending_zloc_names, curr->data);
+ g_free(curr->data);
+ zephyr->pending_zloc_names = g_list_delete_link(zephyr->pending_zloc_names, curr);
return TRUE;
}
}
@@ -1214,12 +1214,11 @@
else if (!g_ascii_strncasecmp(spewtype,"error",5)) {
/* XXX handle */
}
- } else {
}
- } else {
}
free_parse_tree(newparsetree);
+ g_free(newparsetree);
return TRUE;
}
@@ -1439,8 +1438,6 @@
char *tmp = g_strdup_printf("%s", zephyr->username);
char *atptr;
- z_class = triple[0];
- z_instance = triple[1];
if (triple[2] == NULL) {
recip = g_malloc0(1);
} else if (!g_ascii_strcasecmp(triple[2], "%me%")) {
@@ -2799,14 +2796,11 @@
{
PurpleConnection *gc = (PurpleConnection *) action->context;
zephyr_account *zephyr = gc->proto_data;
- gchar *title;
int retval, nsubs, one,i;
ZSubscription_t subs;
if (use_zeph02(zephyr)) {
GString* subout = g_string_new("Subscription list<br>");
- title = g_strdup_printf("Server subscriptions for %s", zephyr->username);
-
if (zephyr->port == 0) {
purple_debug_error("zephyr", "error while retrieving port\n");
return;
@@ -2820,14 +2814,21 @@
one = 1;
if ((retval = ZGetSubscriptions(&subs,&one)) != ZERR_NONE) {
/* XXX better error handling */
- purple_debug_error("zephyr", "error while retrieving individual subscription\n");
- return;
+ break;
}
g_string_append_printf(subout, "Class %s Instance %s Recipient %s<br>",
subs.zsub_class, subs.zsub_classinst,
subs.zsub_recipient);
}
- purple_notify_formatted(gc, title, title, NULL, subout->str, NULL, NULL);
+
+ if (retval == ZERR_NONE) {
+ gchar *title = g_strdup_printf("Server subscriptions for %s", zephyr->username);
+ purple_notify_formatted(gc, title, title, NULL, subout->str, NULL, NULL);
+ g_free(title);
+ } else {
+ /* XXX better error handling */
+ purple_debug_error("zephyr", "error while retrieving individual subscription\n");
+ }
} else {
/* XXX fix */
purple_notify_error(gc,"","tzc doesn't support this action",NULL);