free allocated memory in tr if CLEANUP enabled
Alexey Soloviev
EXT-Alexey.Soloviev at nokia.com
Fri Mar 4 10:55:33 UTC 2011
Hello.
There are quite many places where allocated memory is not freed.
Here is a fix for trivial case in tr.
Signed-off-by: Alexey Soloviev <EXT-Alexey.Soloviev at nokia.com>
---
coreutils/tr.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/coreutils/tr.c b/coreutils/tr.c
index 21d77ef..8dd4a33 100644
--- a/coreutils/tr.c
+++ b/coreutils/tr.c
@@ -323,6 +323,11 @@ int tr_main(int argc UNUSED_PARAM, char **argv)
}
str2[out_index++] = last = coded;
}
+ if (ENABLE_FEATURE_CLEAN_UP) {
+ free(vector);
+ free(str2);
+ free(str1);
+ }
return EXIT_SUCCESS;
}
--
1.7.2.5
More information about the busybox
mailing list