From 39e8284afa2c9eb384b65f24ad9c42c41ba86f23 Mon Sep 17 00:00:00 2001 From: aland Date: Mon, 7 Jul 2003 19:02:48 +0000 Subject: [PATCH] die if failed allocating memory. memset() data to 0. --- src/modules/rlm_detail/rlm_detail.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/modules/rlm_detail/rlm_detail.c b/src/modules/rlm_detail/rlm_detail.c index 84549b8..6bf304b 100644 --- a/src/modules/rlm_detail/rlm_detail.c +++ b/src/modules/rlm_detail/rlm_detail.c @@ -72,7 +72,11 @@ static int detail_instantiate(CONF_SECTION *conf, void **instance) { struct detail_instance *inst; - inst = rad_malloc(sizeof *inst); + inst = rad_malloc(sizeof(*inst)); + if (!inst) { + return -1; + } + memset(inst, 0, sizeof(*inst)); if (cf_section_parse(conf, inst, module_config) < 0) { free(inst); -- 2.1.4