[master] aebfbe944 It is OK to call realloc(3) with a NULL pointer
Poul-Henning Kamp
phk at FreeBSD.org
Thu Apr 18 08:55:08 UTC 2019
commit aebfbe9448c2a57edb21ec469abce2140beec150
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Thu Apr 18 08:39:40 2019 +0000
It is OK to call realloc(3) with a NULL pointer
diff --git a/lib/libvmod_directors/shard_cfg.c b/lib/libvmod_directors/shard_cfg.c
index 70d709c43..62d2e74f1 100644
--- a/lib/libvmod_directors/shard_cfg.c
+++ b/lib/libvmod_directors/shard_cfg.c
@@ -382,12 +382,8 @@ shardcfg_backend_expand(const struct backend_reconfig *re)
else
re->shardd->l_backend <<= 1;
- if (re->shardd->backend)
- re->shardd->backend = realloc(re->shardd->backend,
- re->shardd->l_backend * sizeof *re->shardd->backend);
- else
- re->shardd->backend = malloc(
- re->shardd->l_backend * sizeof *re->shardd->backend);
+ re->shardd->backend = realloc(re->shardd->backend,
+ re->shardd->l_backend * sizeof *re->shardd->backend);
AN(re->shardd->backend);
}
More information about the varnish-commit
mailing list