package/vlc: backport upstream patches to fix compat function for static_assert
[buildroot-gz.git] / package / busybox / 0003-top-move-free-prev_hist-out-of-signal-path.patch
blobf5e29420132d30790fa748b6313b2ffe1465f178
1 From aedc3fe19fac368dc363050e0387d263b7e01cc6 Mon Sep 17 00:00:00 2001
2 From: Denys Vlasenko <vda.linux@googlemail.com>
3 Date: Fri, 19 Aug 2016 11:07:31 +0200
4 Subject: [PATCH] top: move free(prev_hist) out of signal path
6 It was seen being called recursively on repeated signals,
7 leading to double free
9 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 Backported-from: https://git.busybox.net/busybox/commit/?id=aedc3fe19fac368dc363050e0387d263b7e01cc6
11 Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
13 ---
14 procps/top.c | 12 ++++++------
15 1 file changed, 6 insertions(+), 6 deletions(-)
17 diff --git a/procps/top.c b/procps/top.c
18 index 73cd285..6f7f7d3 100644
19 --- a/procps/top.c
20 +++ b/procps/top.c
21 @@ -728,12 +728,6 @@ static void reset_term(void)
23 if (!OPT_BATCH_MODE)
24 tcsetattr_stdin_TCSANOW(&initial_settings);
25 - if (ENABLE_FEATURE_CLEAN_UP) {
26 - clearmems();
27 -# if ENABLE_FEATURE_TOP_CPU_USAGE_PERCENTAGE
28 - free(prev_hist);
29 -# endif
30 - }
33 static void sig_catcher(int sig)
34 @@ -1258,5 +1252,11 @@ int top_main(int argc UNUSED_PARAM, char **argv)
35 #if ENABLE_FEATURE_USE_TERMIOS
36 reset_term();
37 #endif
38 + if (ENABLE_FEATURE_CLEAN_UP) {
39 + clearmems();
40 +#if ENABLE_FEATURE_TOP_CPU_USAGE_PERCENTAGE
41 + free(prev_hist);
42 +#endif
43 + }
44 return EXIT_SUCCESS;
46 --
47 2.7.4