From 03bc379df9a18b8440a26867921f36f02f8656bb Mon Sep 17 00:00:00 2001 From: Mark Vitale Date: Fri, 12 May 2023 23:51:48 -0400 Subject: [PATCH] vol: Don't leak volume bitmaps Since the original IBM code import, attach2 has set the volume's index bitmaps to NULL in preparation for allocating and initalizing new bitmaps. However, the volume may already have bitmaps from previous operations, and this is much more likely with DAFS. In this case, the old bitmaps are leaked. Instead, free any existing bitmap before allocating a new one. Discovered via Solaris libumem.so.1. Reviewed-on: https://gerrit.openafs.org/15428 Tested-by: BuildBot Reviewed-by: Andrew Deason Reviewed-by: Cheyenne Wills Reviewed-by: Benjamin Kaduk (cherry picked from commit 4b42b07fde2cb87ecb0f3135612a4c086227fa09) Change-Id: I8d67a4ef75218acc6e5852b77b90e7898e78585e Reviewed-on: https://gerrit.openafs.org/15517 Tested-by: BuildBot Reviewed-by: Michael Meffie Reviewed-by: Mark Vitale Reviewed-by: Stephan Wiesand --- src/vol/volume.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/vol/volume.c b/src/vol/volume.c index af4189e58b..9590c8cffc 100644 --- a/src/vol/volume.c +++ b/src/vol/volume.c @@ -3367,6 +3367,8 @@ attach2(Error * ec, VolumeId volumeId, char *path, struct DiskPartition64 *partp goto locked_error; } + free(vp->vnodeIndex[vSmall].bitmap); + free(vp->vnodeIndex[vLarge].bitmap); vp->vnodeIndex[vSmall].bitmap = vp->vnodeIndex[vLarge].bitmap = NULL; #ifndef BITMAP_LATER if (programType == fileServer && VolumeWriteable(vp)) {