summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2014-06-19 15:30:49 +0000
committermillert <millert@openbsd.org>2014-06-19 15:30:49 +0000
commit08344973cea4adba8dc7bfc3bab85b6c76ff162d (patch)
treeee712afb66888376f465266d69f25b1a957fbcb0
parentImplement the membar(9) API for powerpc. (diff)
downloadwireguard-openbsd-08344973cea4adba8dc7bfc3bab85b6c76ff162d.tar.xz
wireguard-openbsd-08344973cea4adba8dc7bfc3bab85b6c76ff162d.zip
Fix memory leak in digest_file() on ferror(). OK tedu@ lteo@
-rw-r--r--bin/md5/md5.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/bin/md5/md5.c b/bin/md5/md5.c
index 270ea92be91..9112868d901 100644
--- a/bin/md5/md5.c
+++ b/bin/md5/md5.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: md5.c,v 1.75 2014/03/26 03:16:39 lteo Exp $ */
+/* $OpenBSD: md5.c,v 1.76 2014/06/19 15:30:49 millert Exp $ */
/*
* Copyright (c) 2001,2003,2005-2007,2010,2013,2014
@@ -493,6 +493,10 @@ digest_file(const char *file, struct hash_list *hl, int echo)
warn("%s: read error", file);
if (fp != stdin)
fclose(fp);
+ TAILQ_FOREACH(hf, hl, tailq) {
+ free(hf->ctx);
+ hf->ctx = NULL;
+ }
return(1);
}
if (fp != stdin)