[libvirt PATCH v2 24/24] rpc: rename virNetSessionAuthMethodsFree to virNetSessionAuthMethodsClear

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 src/rpc/virnetsshsession.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/rpc/virnetsshsession.c b/src/rpc/virnetsshsession.c
index 4b56363fa0..5bfe311544 100644
--- a/src/rpc/virnetsshsession.c
+++ b/src/rpc/virnetsshsession.c
@@ -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);
 }
 
-- 
2.29.2




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux