autofs-5.1.8 - fix memory leak in update_hosts_mounts() From: Ian Kent Coverity has reported a memory leak in update_hosts_mounts() introduced by the map reload deadlock fix. Signed-off-by: Ian Kent --- CHANGELOG | 1 + modules/lookup_hosts.c | 13 +++++++------ 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); }