HomeClusterLabs Projects

Low: libcib: Allow cib client reuse in cib__signon_query()

Description

Low: libcib: Allow cib client reuse in cib__signon_query()

Currently, calling cib__signon_query() twice with the same cib argument
causes a memory leak: a new cib_new() return value is assigned to *cib
unconditionally.

With this change, we reuse the existing *cib value if present. Suppose
we have a cib_t object in cib_disconnected state. Now we can safely use
cib__signon_query() to reconnect and perform a query.

If an existing *cib value is already connected, we continue using that
same connection (regardless of whether it's read-write or read-only).

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

Details

Provenance
nrwahl2Authored on Oct 26 2022, 5:05 PM
Parents
rP17219253fbd7: Refactor: libcib: Support some formatted output in cib__signon_query()
Branches
Unknown
Tags
Unknown