aboutsummaryrefslogtreecommitdiff
path: root/src/survive_config.c
diff options
context:
space:
mode:
authorJoshua Allen <axlecrusher@gmail.com>2017-03-08 21:37:20 -0500
committerJoshua Allen <axlecrusher@gmail.com>2017-03-08 21:37:20 -0500
commit9e1eda90ff4c426750eed202c03808f6406988bb (patch)
treeaacf077184bac862f193c2de6d818fee46e011e0 /src/survive_config.c
parente7994264c36713b485b51f5505707bd8743b9e4d (diff)
downloadlibsurvive-9e1eda90ff4c426750eed202c03808f6406988bb.tar.gz
libsurvive-9e1eda90ff4c426750eed202c03808f6406988bb.tar.bz2
do not malloc if size is 0
Diffstat (limited to 'src/survive_config.c')
-rw-r--r--src/survive_config.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/survive_config.c b/src/survive_config.c
index 38c24e1..3f0f199 100644
--- a/src/survive_config.c
+++ b/src/survive_config.c
@@ -31,9 +31,13 @@ void destroy_config_entry(config_entry* ce) {
void init_config_group(config_group *cg, uint16_t count) {
uint16_t i = 0;
- cg->config_entries = malloc(count*sizeof(config_entry));
cg->used_entries = 0;
cg->max_entries = count;
+ cg->config_entries = NULL;
+
+ if (count==0) return;
+
+ cg->config_entries = malloc(count*sizeof(config_entry));
for (i=0;i<count;++i) {
init_config_entry(cg->config_entries+i);