Attached patch prevents exit from hash_file() function without 
de-allocating local buffer "in_buf" if ENABLE_FEATURE_CLEAN_UP
is set.

Alexey Fomenko (1):
  fix small resource leak in hash_file()

 coreutils/md5_sha1_sum.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

-- 
1.7.3.4


>From a04df0fdd17afe5a3da4176f72a7726007ff4646 Mon Sep 17 00:00:00 2001
From: Alexey Fomenko <[email protected]>
Date: Thu, 14 Apr 2011 10:21:38 +0300
Subject: [PATCH] fix small resource leak in hash_file()


Signed-off-by: Alexey Fomenko <[email protected]>
---
 coreutils/md5_sha1_sum.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/coreutils/md5_sha1_sum.c b/coreutils/md5_sha1_sum.c
index 09f3a00..9a0dcbd 100644
--- a/coreutils/md5_sha1_sum.c
+++ b/coreutils/md5_sha1_sum.c
@@ -107,6 +107,9 @@ static uint8_t *hash_file(const char *filename)
 
 	src_fd = open_or_warn_stdin(filename);
 	if (src_fd < 0) {
+		if (ENABLE_FEATURE_CLEAN_UP) {
+			RELEASE_CONFIG_BUFFER(in_buf);
+		};
 		return NULL;
 	}
 
-- 
1.7.3.4

_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to