summaryrefslogtreecommitdiffstats
path: root/usr.sbin/kvm_mkdb/nlist.c
diff options
context:
space:
mode:
authorjsg <jsg@openbsd.org>2016-09-10 05:48:18 +0000
committerjsg <jsg@openbsd.org>2016-09-10 05:48:18 +0000
commit4253757b97a6fcc464fb40dbc01e331581837ae7 (patch)
tree0e20fb5e7a6c0d64a89bdd902ab25a68fcc4adfb /usr.sbin/kvm_mkdb/nlist.c
parentfix an fd leak in an error path (diff)
downloadwireguard-openbsd-4253757b97a6fcc464fb40dbc01e331581837ae7.tar.xz
wireguard-openbsd-4253757b97a6fcc464fb40dbc01e331581837ae7.zip
missing fclose() in an error path
Diffstat (limited to 'usr.sbin/kvm_mkdb/nlist.c')
-rw-r--r--usr.sbin/kvm_mkdb/nlist.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.sbin/kvm_mkdb/nlist.c b/usr.sbin/kvm_mkdb/nlist.c
index 629af583389..18f895a97b0 100644
--- a/usr.sbin/kvm_mkdb/nlist.c
+++ b/usr.sbin/kvm_mkdb/nlist.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nlist.c,v 1.49 2015/12/10 18:40:46 mmcc Exp $ */
+/* $OpenBSD: nlist.c,v 1.50 2016/09/10 05:48:18 jsg Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -84,8 +84,10 @@ __elf_knlist(int fd, DB *db, int ksyms)
if (fseek(fp, (off_t)0, SEEK_SET) == -1 ||
fread(&eh, sizeof(eh), 1, fp) != 1 ||
- !IS_ELF(eh))
+ !IS_ELF(eh)) {
+ fclose(fp);
return (1);
+ }
sh = calloc(sizeof(Elf_Shdr), eh.e_shnum);
if (sh == NULL)