HomeClusterLabs Projects

High: based: Fix double free() in pacemaker-based.c

Description

High: based: Fix double free() in pacemaker-based.c

Moving the contents of the long-unused cib_cleanup() function to the
done section in b8de0aa exposed a bug. We didn't strdup
crm_cluster->uname before assigning to cib_our_uname, but we did strdup
"localhost" if in stand-alone mode. So when we freed cib_our_uname after
freeing crm_cluster, the same pointer would be freed twice if not in
stand-alone mode.

cib_our_uname is used only as a const, so now we just replace it with
"localhost" if stand-alone or crm_cluster->uname otherwise. We're
avoiding a separate const char * global for future-proofing, in case
crm_cluster or its uname member is ever freed and reassigned.

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>

Details

Provenance
nrwahl2Authored on Dec 1 2022, 3:43 PM
Parents
rP2d69be23f443: Merge pull request #2965 from nrwahl2/nrwahl2-T456
Branches
Unknown
Tags
Unknown