Many null pointer checks

This commit is contained in:
Marc Stern
2024-02-20 13:15:52 +01:00
parent 07f4076f46
commit 91da5872c1
22 changed files with 1180 additions and 290 deletions

View File

@@ -21,6 +21,8 @@
static apr_table_t *collection_unpack(modsec_rec *msr, const unsigned char *blob, unsigned int blob_size,
int log_vars)
{
assert(msr != NULL);
assert(blob != NULL);
apr_table_t *col = NULL;
unsigned int blob_offset;
@@ -90,6 +92,8 @@ static apr_table_t *collection_unpack(modsec_rec *msr, const unsigned char *blob
static apr_table_t *collection_retrieve_ex(apr_sdbm_t *existing_dbm, modsec_rec *msr, const char *col_name,
const char *col_key, int col_key_len)
{
assert(msr != NULL);
assert(col_name != NULL);
char *dbm_filename = NULL;
apr_status_t rc;
apr_sdbm_datum_t key;
@@ -346,6 +350,7 @@ cleanup:
apr_table_t *collection_retrieve(modsec_rec *msr, const char *col_name,
const char *col_key, int col_key_len)
{
assert(msr != NULL);
apr_time_t time_before = apr_time_now();
apr_table_t *rtable = NULL;
@@ -360,6 +365,7 @@ apr_table_t *collection_retrieve(modsec_rec *msr, const char *col_name,
*
*/
int collection_store(modsec_rec *msr, apr_table_t *col) {
assert(msr != NULL);
char *dbm_filename = NULL;
msc_string *var_name = NULL, *var_key = NULL;
unsigned char *blob = NULL;
@@ -647,6 +653,8 @@ error:
*
*/
int collections_remove_stale(modsec_rec *msr, const char *col_name) {
assert(msr != NULL);
assert(col_name != NULL);
char *dbm_filename = NULL;
apr_sdbm_datum_t key, value;
apr_sdbm_t *dbm = NULL;