Fix Coverity Warnings

Explicitly check filter_type is not NULL even though the current code
never passed a NULL filter_type unless filter was also NULL.

Remove unreachable code.

Change-Id: Ib2bd9b2d6e9e559e61a895a25235669dae05fdf6
Related: coverity CID#216865
Related: coverity CID#216867
This commit is contained in:
Keith Whyte 2021-01-30 13:49:15 -06:00
parent 89fda3024a
commit b5a5676cff
1 changed files with 3 additions and 7 deletions

View File

@ -663,7 +663,7 @@ int db_subscrs_get(struct db_context *dbc, const char *filter_type, const char *
return -EIO;
}
if (filter && strcmp(filter_type, "last_lu_seen") != 0) {
if (filter_type && filter && strcmp(filter_type, "last_lu_seen") != 0) {
if (strcmp(filter, "on") == 0) {
sprintf(search, "%s", "1");
} else if (strcmp(filter, "off") == 0) {
@ -703,16 +703,12 @@ int db_subscrs_get(struct db_context *dbc, const char *filter_type, const char *
db_remove_reset(stmt);
if (rc != SQLITE_DONE) {
*err = sqlite3_errmsg(dbc->db);
return -EIO;
} else if (rc == SQLITE_DONE) {
*err = NULL;
return 0;
} else {
*err = sqlite3_errmsg(dbc->db);
LOGP(DAUC, LOGL_ERROR, "Cannot read subscribers from db:: %s\n", *err);
return rc;
}
*err = NULL;
return 0;
}
/*! Retrieve subscriber data from the HLR database.