[master] 779459acd Apply replace.cocci patch for @fgsch's suggestion

Poul-Henning Kamp phk at FreeBSD.org
Mon Oct 21 11:56:06 UTC 2019


commit 779459acd1de98e59f22e81caa90a39e7aac3c27
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Thu Oct 17 12:05:17 2019 +0200

    Apply replace.cocci patch for @fgsch's suggestion

diff --git a/bin/varnishd/mgt/mgt_param.c b/bin/varnishd/mgt/mgt_param.c
index b65884eae..b15540f32 100644
--- a/bin/varnishd/mgt/mgt_param.c
+++ b/bin/varnishd/mgt/mgt_param.c
@@ -708,21 +708,15 @@ MCF_ParamConf(enum mcf_which_e which, const char * const param,
 	AZ(VSB_finish(vsb));
 	switch (which) {
 	case MCF_DEFAULT:
-		free(pp->dyn_def);
-		pp->dyn_def = strdup(VSB_data(vsb));
-		AN(pp->dyn_def);
+		REPLACE(pp->dyn_def, VSB_data(vsb));
 		pp->def = pp->dyn_def;
 		break;
 	case MCF_MINIMUM:
-		free(pp->dyn_min);
-		pp->dyn_min = strdup(VSB_data(vsb));
-		AN(pp->dyn_min);
+		REPLACE(pp->dyn_min, VSB_data(vsb));
 		pp->min = pp->dyn_min;
 		break;
 	case MCF_MAXIMUM:
-		free(pp->dyn_max);
-		pp->dyn_max = strdup(VSB_data(vsb));
-		AN(pp->dyn_max);
+		REPLACE(pp->dyn_max, VSB_data(vsb));
 		pp->max = pp->dyn_max;
 		break;
 	default:


More information about the varnish-commit mailing list