]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
afs: Free 'addrs' array
authorAndrew Deason <adeason@sinenomine.net>
Mon, 1 Oct 2018 15:56:53 +0000 (11:56 -0400)
committerStephan Wiesand <stephan.wiesand@desy.de>
Sun, 26 Jan 2020 18:32:37 +0000 (13:32 -0500)
Currently, 3 places in libafs allocate an 'addrs' array in a very
similar way to loop through our list of servers:
ForceAllNewConnections(), afs_LoopServers(), and PCallBackAddr(). Of
these, only afs_LoopServers actually frees the array.
ForceAllNewConnections and PCallBackAddr leak the memory, but these
are only hit from infrequent pioctls that can only be run by root, so
the impact is small.

Fix ForceAllNewConnections and PCallBackAddr to free the array.

Reviewed-on: https://gerrit.openafs.org/13355
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 0548ee436d0f0f92a980d22e03149faedf38dc70)

Change-Id: I5d64899c7be40ba3e1b0985c4829933eebbd8323
Reviewed-on: https://gerrit.openafs.org/13899
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
src/afs/afs_pioctl.c
src/afs/afs_server.c

index b114a1edbaba13b7bd32f82e3b4c5e5a61d0583c..cd6907fcae89d24c36975d0a711fae29d3ac0780 100644 (file)
@@ -5244,6 +5244,7 @@ DECL_PIOCTL(PCallBackAddr)
        }
        afs_PutConn(tc, rxconn, SHARED_LOCK);   /* done with it now */
     }                          /* Outer loop over addrs */
+    afs_osi_Free(addrs, srvAddrCount * sizeof(*addrs));
 #endif /* UKERNEL */
     return 0;
 }
index 68fefc68b9cd95e05ba8abe24c2bfecd440dadc6..700492f3c677081848768cbd6411a7fabbca55cf 100644 (file)
@@ -515,6 +515,8 @@ ForceAllNewConnections(void)
         sa = addrs[i];
        ForceNewConnections(sa);
     }
+
+    afs_osi_Free(addrs, srvAddrCount * sizeof(*addrs));
 }
 
 static void