aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIan Kent <raven@themaw.net>2022-11-28 22:45:24 +0800
committerIan Kent <raven@themaw.net>2022-11-29 08:37:55 +0800
commit145da73ca18178ee9b179310c6234b454abb1836 (patch)
tree190903f4da65d66465edbe3fed2da81d4bea9b06
parent3d3eeeceaeb774360d91d52fe67c861d33df20c2 (diff)
downloadautofs-145da73ca18178ee9b179310c6234b454abb1836.tar.gz
autofs-5.1.8 - fix memory leak in update_hosts_mounts()
Coverity has reported a memory leak in update_hosts_mounts() introduced by the map reload deadlock fix. Signed-off-by: Ian Kent <raven@themaw.net>
-rw-r--r--CHANGELOG1
-rw-r--r--modules/lookup_hosts.c13
2 files changed, 8 insertions, 6 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 2ec4cc31..e75f341f 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -46,6 +46,7 @@
- coverity fix for invalid access.
- fix hosts map deadlock on restart.
- fix deadlock with hosts map reload.
+- fix memory leak in update_hosts_mounts().
19/10/2021 autofs-5.1.8
- add xdr_exports().
diff --git a/modules/lookup_hosts.c b/modules/lookup_hosts.c
index 0d46eb3e..9ee76fdc 100644
--- a/modules/lookup_hosts.c
+++ b/modules/lookup_hosts.c
@@ -307,20 +307,21 @@ next:
}
pthread_cleanup_pop(1);
- while (head) {
+ entries = head;
+ while (entries) {
debug(ap->logopt, MODPREFIX
- "attempt to update exports for %s", head->key);
+ "attempt to update exports for %s", entries->key);
master_source_current_wait(ap->entry);
ap->entry->current = source;
ap->flags |= MOUNT_FLAG_REMOUNT;
- ret = ctxt->parse->parse_mount(ap, head->key, strlen(head->key),
- head->entry, ctxt->parse->context);
+ ret = ctxt->parse->parse_mount(ap, entries->key, strlen(entries->key),
+ entries->entry, ctxt->parse->context);
if (ret)
warn(ap->logopt, MODPREFIX
- "failed to parse mount %s", head->entry);
+ "failed to parse mount %s", entries->entry);
ap->flags &= ~MOUNT_FLAG_REMOUNT;
- head = head->next;
+ entries = entries->next;
}
pthread_cleanup_pop(1);
}