summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>2005-07-13 21:28:03 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>2005-07-13 21:28:03 +0000
commit0837dff6faa0df563dfb7fa2db0f7315a1e706d3 (patch)
tree85564d0ec7e4b3b655d6e96cbf41d79122c40bce
parentaaea3ff90a20f80dbe60cd7d0e436f6b87889be0 (diff)
do not leak memory if read()ing section headers fails; from Andrey Matveev <evol@online.ptt.ru>
-rw-r--r--sys/lib/libsa/loadfile.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/lib/libsa/loadfile.c b/sys/lib/libsa/loadfile.c
index b861b93c6c8..1da87241d1e 100644
--- a/sys/lib/libsa/loadfile.c
+++ b/sys/lib/libsa/loadfile.c
@@ -1,5 +1,5 @@
/* $NetBSD: loadfile.c,v 1.10 2000/12/03 02:53:04 tsutsui Exp $ */
-/* $OpenBSD: loadfile.c,v 1.9 2004/02/10 01:01:13 tom Exp $ */
+/* $OpenBSD: loadfile.c,v 1.10 2005/07/13 21:28:02 mickey Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -357,6 +357,7 @@ elf_exec(int fd, Elf_Ehdr *elf, u_long *marks, int flags)
if (read(fd, shp, sz) != sz) {
WARN(("read section headers"));
+ FREE(shp, sz);
return 1;
}