Valgrind complained about a minor leak within FileLock_Lock when running
test-vmx Firmware.Efi.QuickBoot . FileLockScanner builds a list of "active
locks" and traverses that list repeatedly, but whenever it decides to remove
an entry from the list, it would simply leak it.
This change ensures that the list item is not leaked by Posix_Free()ing it
once it is no longer needed.
/*********************************************************
- * Copyright (C) 2007-2019 VMware, Inc. All rights reserved.
+ * Copyright (C) 2007-2020 VMware, Inc. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
}
if (remove) {
+ ActiveLock *temp = ptr;
+
+ ptr = ptr->next;
+ Posix_Free(temp->dirName);
+ Posix_Free(temp);
+
if (prev == NULL) {
- myValues->lockList = ptr->next;
+ myValues->lockList = ptr;
} else {
- prev->next = ptr->next;
+ prev->next = ptr;
}
+ } else {
+ prev = ptr;
+ ptr = ptr->next;
}
-
- prev = ptr;
- ptr = ptr->next;
}
FileSleeper(FILELOCK_PROGRESS_SAMPLE,