summaryrefslogtreecommitdiff
path: root/bin/md5
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2014-06-19 15:30:50 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2014-06-19 15:30:50 +0000
commit285751f63f0ecd8e4ebe7e0c11ce46a377530b4e (patch)
tree23524ecbf7f6717595c3615410e4227e43915c57 /bin/md5
parentdc9578484b3c0db8c52d139c801921598ffe4d96 (diff)
Fix memory leak in digest_file() on ferror(). OK tedu@ lteo@
Diffstat (limited to 'bin/md5')
-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)