From: Andrew Deason Date: Mon, 1 Oct 2018 15:56:53 +0000 (-0400) Subject: afs: Free 'addrs' array X-Git-Tag: upstream/1.8.6_pre1^2~37 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=62ec1c913134f515802140e48e6386ec35559767;p=packages%2Fo%2Fopenafs.git afs: Free 'addrs' array 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 Reviewed-by: Benjamin Kaduk (cherry picked from commit 0548ee436d0f0f92a980d22e03149faedf38dc70) Change-Id: I5d64899c7be40ba3e1b0985c4829933eebbd8323 Reviewed-on: https://gerrit.openafs.org/13899 Reviewed-by: Andrew Deason Reviewed-by: Michael Meffie Tested-by: BuildBot Reviewed-by: Stephan Wiesand --- diff --git a/src/afs/afs_pioctl.c b/src/afs/afs_pioctl.c index b114a1edb..cd6907fca 100644 --- a/src/afs/afs_pioctl.c +++ b/src/afs/afs_pioctl.c @@ -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; } diff --git a/src/afs/afs_server.c b/src/afs/afs_server.c index 68fefc68b..700492f3c 100644 --- a/src/afs/afs_server.c +++ b/src/afs/afs_server.c @@ -515,6 +515,8 @@ ForceAllNewConnections(void) sa = addrs[i]; ForceNewConnections(sa); } + + afs_osi_Free(addrs, srvAddrCount * sizeof(*addrs)); } static void