summaryrefslogtreecommitdiff
path: root/src/mod_evhost.c
diff options
context:
space:
mode:
authorGlenn Strauss <gstrauss@gluelogic.com>2022-12-10 15:15:33 -0500
committerGlenn Strauss <gstrauss@gluelogic.com>2022-12-10 15:15:33 -0500
commit5e14db43b7212b52f1cfcd2b0fce41df7fc419eb (patch)
tree1ae34085634983b89f972101f51785ce4d7ff30b /src/mod_evhost.c
parentabf470bebe446db762e01d04e894691390da7d45 (diff)
downloadlighttpd-git-5e14db43b7212b52f1cfcd2b0fce41df7fc419eb.tar.gz
[multiple] employ ck_calloc, ck_malloc shared code
employ ck_calloc(), ck_malloc() shared code to slightly reduce code size (centralize the ck_assert() to check that memory allocation succeeded)
Diffstat (limited to 'src/mod_evhost.c')
-rw-r--r--src/mod_evhost.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/mod_evhost.c b/src/mod_evhost.c
index 0ab26b89..258cb11c 100644
--- a/src/mod_evhost.c
+++ b/src/mod_evhost.c
@@ -38,7 +38,7 @@ typedef struct {
} plugin_data;
INIT_FUNC(mod_evhost_init) {
- return calloc(1, sizeof(plugin_data));
+ return ck_calloc(1, sizeof(plugin_data));
}
static void mod_evhost_free_path_pieces(const buffer *path_pieces) {
@@ -125,9 +125,7 @@ static buffer * mod_evhost_parse_pattern(const char *ptr) {
++used;
}
- buffer * const path_pieces =
- malloc(sizeof(bptr) + ((used+1) * sizeof(buffer)));
- force_assert(path_pieces);
+ buffer * const path_pieces = ck_malloc((used+1) * sizeof(buffer));
return memcpy(path_pieces, bptr, (used+1) * sizeof(buffer));
}