aboutsummaryrefslogtreecommitdiff
path: root/hostfile.c
diff options
context:
space:
mode:
authorEd Maste <emaste@FreeBSD.org>2026-04-06 13:03:29 +0000
committerEd Maste <emaste@FreeBSD.org>2026-04-06 13:16:02 +0000
commit2c72d8219c5679490c3becad8118ea5c8950b893 (patch)
tree9745ca96f363514e3aa34b48c397016f4a241bc5 /hostfile.c
parent2137aa9d9fd3f2a3ebc1aa12c6e56ece99fa067c (diff)
Diffstat (limited to 'hostfile.c')
-rw-r--r--hostfile.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/hostfile.c b/hostfile.c
index 4cec57da50c6..033b29104879 100644
--- a/hostfile.c
+++ b/hostfile.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hostfile.c,v 1.99 2025/05/06 05:40:56 djm Exp $ */
+/* $OpenBSD: hostfile.c,v 1.100 2025/11/25 00:57:04 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -626,7 +626,7 @@ hostfile_replace_entries(const char *filename, const char *host, const char *ip,
int r, fd, oerrno = 0;
int loglevel = quiet ? SYSLOG_LEVEL_DEBUG1 : SYSLOG_LEVEL_VERBOSE;
struct host_delete_ctx ctx;
- char *fp, *temp = NULL, *back = NULL;
+ char *fp = NULL, *temp = NULL, *back = NULL;
const char *what;
mode_t omask;
size_t i;
@@ -715,6 +715,7 @@ hostfile_replace_entries(const char *filename, const char *host, const char *ip,
host, ip == NULL ? "" : ",", ip == NULL ? "" : ip, filename,
sshkey_ssh_name(keys[i]), fp);
free(fp);
+ fp = NULL;
ctx.modified = 1;
}
fclose(ctx.out);
@@ -755,6 +756,7 @@ hostfile_replace_entries(const char *filename, const char *host, const char *ip,
unlink(temp);
free(temp);
free(back);
+ free(fp);
if (ctx.out != NULL)
fclose(ctx.out);
free(ctx.match_keys);