]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
rpc: rename virNetSessionAuthMethodsFree to virNetSessionAuthMethodsClear
authorLaine Stump <laine@redhat.com>
Thu, 4 Feb 2021 02:51:04 +0000 (21:51 -0500)
committerLaine Stump <laine@redhat.com>
Fri, 5 Feb 2021 05:22:09 +0000 (00:22 -0500)
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>
src/rpc/virnetsshsession.c

index 4b56363fa055fdd5e7169a2d5556c12e3fbb6016..5bfe3115443d0e30915807bcd335b5c9a1b365ac 100644 (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);
 }