From 0548ee436d0f0f92a980d22e03149faedf38dc70 Mon Sep 17 00:00:00 2001 From: Andrew Deason Date: Mon, 1 Oct 2018 11:56:53 -0400 Subject: [PATCH] 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. Change-Id: Ic348e29cefa7c41cbcb30f738f943e8d022a97f0 Reviewed-on: https://gerrit.openafs.org/13355 Tested-by: BuildBot Reviewed-by: Benjamin Kaduk --- src/afs/afs_pioctl.c | 1 + src/afs/afs_server.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/afs/afs_pioctl.c b/src/afs/afs_pioctl.c index cfc79a2..3152054 100644 --- a/src/afs/afs_pioctl.c +++ b/src/afs/afs_pioctl.c @@ -5241,6 +5241,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 79b4704..5977604 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 -- 1.9.4