From 6c24b1c858194b809c19167c1aeabccd73fd10f5 Mon Sep 17 00:00:00 2001 From: Michael Rash Date: Wed, 10 Jul 2013 23:09:41 -0400 Subject: [PATCH] [libfko] always call free() from zero_free() on all non-NULL buf pointers --- lib/fko_util.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/fko_util.c b/lib/fko_util.c index 8d299fa0..e70e6eab 100644 --- a/lib/fko_util.c +++ b/lib/fko_util.c @@ -404,9 +404,15 @@ int zero_free(char *buf, int len) { int res = FKO_SUCCESS; - if(buf == NULL || len == 0) + if(buf == NULL) return res; + if(len == 0) + { + free(buf); /* always free() if buf != NULL */ + return res; + } + res = zero_buf(buf, len); free(buf);