Reported by GitHub user brhenc in issue #3597 (a follow-up of the Coverity
report in #2428). In da_haproxy_checkinst(), "cnew" is filled by
da_atlas_compile(), which does not guarantee to write anything back to
the caller-supplied pointer when the compilation fails. The free() on
the error path could then be called on an indeterminate stack value and
crash the process. The fix introduced by
d8ff676592 ("fix resource leak
on hot-reload compile failure") is preserved since free(NULL) is a no-op
if the library leaves the output untouched.
This must be backported to 3.4, 3.3, 3.2, 3.1 and 3.0, which all received
d8ff676592.
if (base[0] != 0 && base[0] != '0') {
FILE *jsonp;
- void *cnew, *cold;
+ void *cnew = NULL, *cold;
da_status_t status;
size_t atlassz;
char atlasp[ATLASTOKSZ] = {0};