cppcheck: suppress warnings
The remaining warnings are either not valid or refer to code which is intentionally broken. Suppress these warnings. SyncEvolution now passes scanning with cppcheck 1.61 without warnings.
This commit is contained in:
parent
edc21305af
commit
fa6db3eba7
|
@ -79,6 +79,9 @@ int main(int argc, char **argv, char **envp)
|
|||
// the process is running.
|
||||
void *dummy = malloc(1);
|
||||
free(dummy);
|
||||
// cppcheck-suppress deallocDealloc
|
||||
// cppcheck-suppress doubleFree
|
||||
// cppcheck-suppress uninitvar
|
||||
free(dummy);
|
||||
}
|
||||
|
||||
|
|
|
@ -248,6 +248,8 @@ guint b_dbus_add_service_watch(DBusConnection *connection, const char *name,
|
|||
return watch->id;
|
||||
|
||||
error:
|
||||
// Doesn't look valid: Possible null pointer dereference: watch - otherwise it is redundant to check it against null.
|
||||
// cppcheck-suppress nullPointer
|
||||
if (watch != NULL) {
|
||||
g_free(watch->name);
|
||||
g_free(watch->match);
|
||||
|
@ -518,6 +520,8 @@ guint b_dbus_add_signal_watch(DBusConnection *connection, const char *rule,
|
|||
return signal->id;
|
||||
|
||||
error:
|
||||
// Doesn't look valid: Possible null pointer dereference: signal - otherwise it is redundant to check it against null.
|
||||
// cppcheck-suppress nullPointer
|
||||
if (signal)
|
||||
g_free(signal->match);
|
||||
g_free(signal);
|
||||
|
|
|
@ -1077,6 +1077,8 @@ struct MethodHandler
|
|||
// unref 'invocation' immediately after referencing the underlying message.
|
||||
DBusMessagePtr msg(g_dbus_method_invocation_get_message(invocation), true);
|
||||
g_object_unref(invocation);
|
||||
// Set to NULL, just to be sure we remember that it is gone.
|
||||
// cppcheck-suppress uselessAssignmentPtrArg
|
||||
invocation = NULL;
|
||||
|
||||
// We are calling callback because we want to keep server alive as long
|
||||
|
@ -4581,6 +4583,8 @@ struct Ret1Traits : public TraitsBase<boost::function<void (const R1 &, const st
|
|||
data->m_callback(r, error_msg);
|
||||
}
|
||||
delete data;
|
||||
// cppcheck-suppress nullPointer
|
||||
// Looks invalid: cppcheck warning: nullPointer - Possible null pointer dereference: error - otherwise it is redundant to check it against null.
|
||||
if (error != NULL) {
|
||||
g_error_free (error);
|
||||
}
|
||||
|
@ -4621,6 +4625,8 @@ struct Ret2Traits : public TraitsBase<boost::function<void (const R1 &, const R2
|
|||
data->m_callback(r1, r2, error_msg);
|
||||
}
|
||||
delete data;
|
||||
// cppcheck-suppress nullPointer
|
||||
// Looks invalid: cppcheck warning: nullPointer - Possible null pointer dereference: error - otherwise it is redundant to check it against null.
|
||||
if (error != NULL) {
|
||||
g_error_free (error);
|
||||
}
|
||||
|
@ -4662,6 +4668,8 @@ struct Ret3Traits : public TraitsBase<boost::function<void (const R1 &, const R2
|
|||
data->m_callback(r1, r2, r3, error_msg);
|
||||
}
|
||||
delete data;
|
||||
// cppcheck-suppress nullPointer
|
||||
// Looks invalid: cppcheck warning: nullPointer - Possible null pointer dereference: error - otherwise it is redundant to check it against null.
|
||||
if (error != NULL) {
|
||||
g_error_free (error);
|
||||
}
|
||||
|
|
|
@ -47,9 +47,15 @@ int main(int argc, char **argv)
|
|||
// segfault
|
||||
void *small = malloc(1);
|
||||
free(small);
|
||||
// cppcheck-suppress deallocDealloc
|
||||
// cppcheck-suppress doubleFree
|
||||
// cppcheck-suppress uninitvar
|
||||
free(small);
|
||||
void *large = malloc(1024 * 1024);
|
||||
free(large);
|
||||
// cppcheck-suppress deallocDealloc
|
||||
// cppcheck-suppress doubleFree
|
||||
// cppcheck-suppress uninitvar
|
||||
free(large);
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue