From ac9c9935a25422999f0d637b02009beb898b76b0 Mon Sep 17 00:00:00 2001 From: Glenn Strauss Date: Wed, 27 Oct 2021 18:04:20 -0400 Subject: [PATCH] [multiple] add assert after malloc in two spots add missing assert after malloc in two spots to detect malloc failure (unlikely) --- src/mod_dirlisting.c | 1 + src/mod_mysql_vhost.c | 1 + 2 files changed, 2 insertions(+) diff --git a/src/mod_dirlisting.c b/src/mod_dirlisting.c index 54134336..5f0b1930 100644 --- a/src/mod_dirlisting.c +++ b/src/mod_dirlisting.c @@ -1077,6 +1077,7 @@ static int http_read_directory(handler_ctx * const p) { } dirls_entry_t * const tmp = list->ent[list->used++] = (dirls_entry_t*) malloc(sizeof(dirls_entry_t) + 1 + dsz); + force_assert(tmp); tmp->mtime = st.st_mtime; tmp->size = st.st_size; tmp->namelen = dsz; diff --git a/src/mod_mysql_vhost.c b/src/mod_mysql_vhost.c index ba7b9e4a..edb0e168 100644 --- a/src/mod_mysql_vhost.c +++ b/src/mod_mysql_vhost.c @@ -68,6 +68,7 @@ static void* mod_mysql_vhost_connection_data(request_st * const r, void *p_d) if (c) return c; c = calloc(1, sizeof(*c)); + force_assert(c); c->server_name = buffer_init(); c->document_root = buffer_init();