From: William Lallemand Date: Wed, 12 Feb 2025 14:29:39 +0000 (+0100) Subject: MINOR: ssl/crtlist: handle crt_path == cc->crt in crtlist_load_crt() X-Git-Tag: v3.2-dev6~14 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0330011acf699b5172c6b31c0f0d4acc3ad964f6;p=thirdparty%2Fhaproxy.git MINOR: ssl/crtlist: handle crt_path == cc->crt in crtlist_load_crt() Handle the case where crt_path == cc->crt, so the pointer doesn't get free'd before getting strdup'ed in crtlist_load_crt(). --- diff --git a/src/ssl_crtlist.c b/src/ssl_crtlist.c index 0e3bbb097..1caaed7fd 100644 --- a/src/ssl_crtlist.c +++ b/src/ssl_crtlist.c @@ -520,11 +520,14 @@ int crtlist_load_crt(char *crt_path, struct ckch_conf *cc, struct crtlist *newli if (ckchs == NULL) { if (stat(crt_path, &st) == 0) { found++; - free(cc->crt); - cc->crt = strdup(crt_path); - if (cc->crt == NULL) { - cfgerr |= ERR_ALERT | ERR_FATAL; - goto error; + + if (crt_path != cc->crt) { + free(cc->crt); + cc->crt = strdup(crt_path); + if (cc->crt == NULL) { + cfgerr |= ERR_ALERT | ERR_FATAL; + goto error; + } } ckchs = ckch_store_new_load_files_conf(crt_path, cc, err);