pidgin/pidgin

Fix some issues scanbuild found in prefs.c
release-2.x.y
2021-06-01, Gary Kramlich
8b3be4e34e27
Parents 8aafbbfc4f42
Children 53938c5a6e15
Fix some issues scanbuild found in prefs.c

Testing Done:
Verified scanbuild no longer detected the errors.

Reviewed at https://reviews.imfreedom.org/r/700/
--- a/libpurple/prefs.c Tue Jun 01 20:14:36 2021 -0500
+++ b/libpurple/prefs.c Tue Jun 01 20:15:16 2021 -0500
@@ -756,14 +756,17 @@
static void
remove_pref(struct purple_pref *pref)
{
+ struct purple_pref *child = NULL, *next = NULL;
char *name;
GSList *l;
if(!pref)
return;
- while(pref->first_child)
- remove_pref(pref->first_child);
+ for(child = pref->first_child; child != NULL; child = next) {
+ next = child->sibling;
+ remove_pref(child);
+ }
if(pref == &prefs)
return;
@@ -1581,7 +1584,6 @@
GSList *cbs;
PurplePrefsUiOps *uiop = purple_prefs_get_ui_ops();
- cbs = ui_callbacks;
for (cbs = ui_callbacks; cbs; cbs = cbs->next) {
PurplePrefCallbackData *cb = cbs->data;
if (cb->handle != handle) {