pidgin/pidgin

Fix some issues in the tcl loader that scanbuild found
release-2.x.y
2021-06-03, Gary Kramlich
f484a9317ad7
Parents 814b934cf5b7
Children a4a68d315090
Fix some issues in the tcl loader that scanbuild found

Testing Done:
Verified the errors are no longer detected by scanbuild.

Reviewed at https://reviews.imfreedom.org/r/717/
--- a/libpurple/plugins/tcl/tcl_cmds.c Wed Jun 02 17:59:31 2021 -0500
+++ b/libpurple/plugins/tcl/tcl_cmds.c Thu Jun 03 19:30:26 2021 -0500
@@ -189,7 +189,7 @@
purple_account_get_enabled(account,
purple_core_get_ui())));
} else {
- if ((error = Tcl_GetBooleanFromObj(interp, objv[3], &b)) != TCL_OK)
+ if (Tcl_GetBooleanFromObj(interp, objv[3], &b) != TCL_OK)
return TCL_ERROR;
purple_account_set_enabled(account, purple_core_get_ui(), b);
}
@@ -1319,14 +1319,12 @@
}
break;
}
- if ((error = Tcl_GetBooleanFromObj(interp, objv[3], &idle)) != TCL_OK)
+ if (Tcl_GetBooleanFromObj(interp, objv[3], &idle) != TCL_OK)
return TCL_ERROR;
if (objc == 4) {
purple_presence_set_idle(presence, idle, time(NULL));
} else if (objc == 5) {
- if ((error = Tcl_GetIntFromObj(interp,
- objv[4],
- &idle_time)) != TCL_OK)
+ if (Tcl_GetIntFromObj(interp, objv[4], &idle_time) != TCL_OK)
return TCL_ERROR;
purple_presence_set_idle(presence, idle, idle_time);
}
--- a/libpurple/plugins/tcl/tcl_signals.c Wed Jun 02 17:59:31 2021 -0500
+++ b/libpurple/plugins/tcl/tcl_signals.c Thu Jun 03 19:30:26 2021 -0500
@@ -371,8 +371,10 @@
case PURPLE_TYPE_STRING:
if (purple_value_is_outgoing(handler->argtypes[i])) {
if (vals[i] != NULL && *(char **)vals[i] != NULL) {
- g_free(*strs[i]);
- *strs[i] = g_strdup(vals[i]);
+ if(strs[i] != NULL) {
+ g_free(*strs[i]);
+ *strs[i] = g_strdup(vals[i]);
+ }
}
ckfree(vals[i]);
}