rpc: rename virNetSessionAuthMethodsFree to virNetSessionAuthMethodsClear

This is another *Free() function that doesn't free the object it is
passed. Instead it frees and clears some parts of the object.

In this case, the function is actually called from two places, and one
of them (virNetSSHSessionAuthReset) appears to be assuming that the
pointers actually *will* be cleared. So the proper thing to do here
(?) is to rename the function to virNetSSHSesionAuthMethodsClear().

(NB: virNetSSHSessionAuthReset is seemingly never called from
anywhere. Is this one of those functions that actually *is* called by
some strange MACRO invocation? Or it is truly one of those
"written-but-never-used" functions that can be deleted? (if the latter
is the case, then I would rather move the contents of
virNetSessionAuthMethodsFree() into its only other caller,
virNetSSHSessionDispose(), so that the VIR_FREEs could be replaced
with g_free.)

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
This commit is contained in:
Laine Stump 2021-02-03 21:51:04 -05:00
parent 5fb0c789c3
commit 1745297d51

View File

@ -113,7 +113,7 @@ struct _virNetSSHSession {
};
static void
virNetSSHSessionAuthMethodsFree(virNetSSHSessionPtr sess)
virNetSSHSessionAuthMethodsClear(virNetSSHSessionPtr sess)
{
size_t i;
@ -149,7 +149,7 @@ virNetSSHSessionDispose(void *obj)
libssh2_session_free(sess->session);
}
virNetSSHSessionAuthMethodsFree(sess);
virNetSSHSessionAuthMethodsClear(sess);
VIR_FREE(sess->channelCommand);
VIR_FREE(sess->hostname);
@ -971,7 +971,7 @@ void
virNetSSHSessionAuthReset(virNetSSHSessionPtr sess)
{
virObjectLock(sess);
virNetSSHSessionAuthMethodsFree(sess);
virNetSSHSessionAuthMethodsClear(sess);
virObjectUnlock(sess);
}