diff options
author | Guilherme Maciel Ferreira <guilherme.maciel.ferreira@gmail.com> | 2013-10-16 14:43:30 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2013-10-16 14:43:30 +0200 |
commit | 840ef17f63c85044c15d9a38a13c6539e26dfc31 (patch) | |
tree | 83c17eefba33cc8c01f9f6e461cc5603e988fd3e | |
parent | 5117eff6f938a6daa269f965a52abc93b49d90d6 (diff) | |
download | busybox-w32-840ef17f63c85044c15d9a38a13c6539e26dfc31.tar.gz busybox-w32-840ef17f63c85044c15d9a38a13c6539e26dfc31.tar.bz2 busybox-w32-840ef17f63c85044c15d9a38a13c6539e26dfc31.zip |
wget: if FEATURE_CLEAN_UP, free(ptr_to_globals)
Signed-off-by: Guilherme Maciel Ferreira <guilherme.maciel.ferreira@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | include/libbb.h | 5 | ||||
-rw-r--r-- | networking/wget.c | 8 |
2 files changed, 13 insertions, 0 deletions
diff --git a/include/libbb.h b/include/libbb.h index 3ab1d6b46..c96546109 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
@@ -1773,6 +1773,11 @@ extern struct globals *const ptr_to_globals; | |||
1773 | (*(struct globals**)&ptr_to_globals) = (void*)(x); \ | 1773 | (*(struct globals**)&ptr_to_globals) = (void*)(x); \ |
1774 | barrier(); \ | 1774 | barrier(); \ |
1775 | } while (0) | 1775 | } while (0) |
1776 | #define FREE_PTR_TO_GLOBALS() do { \ | ||
1777 | if (ENABLE_FEATURE_CLEAN_UP) { \ | ||
1778 | free(ptr_to_globals); \ | ||
1779 | } \ | ||
1780 | } while (0) | ||
1776 | 1781 | ||
1777 | /* You can change LIBBB_DEFAULT_LOGIN_SHELL, but don't use it, | 1782 | /* You can change LIBBB_DEFAULT_LOGIN_SHELL, but don't use it, |
1778 | * use bb_default_login_shell and following defines. | 1783 | * use bb_default_login_shell and following defines. |
diff --git a/networking/wget.c b/networking/wget.c index a32f85229..cfbaceced 100644 --- a/networking/wget.c +++ b/networking/wget.c | |||
@@ -89,6 +89,9 @@ struct globals { | |||
89 | #define INIT_G() do { \ | 89 | #define INIT_G() do { \ |
90 | SET_PTR_TO_GLOBALS(xzalloc(sizeof(G))); \ | 90 | SET_PTR_TO_GLOBALS(xzalloc(sizeof(G))); \ |
91 | } while (0) | 91 | } while (0) |
92 | #define FINI_G() do { \ | ||
93 | FREE_PTR_TO_GLOBALS(); \ | ||
94 | } while (0) | ||
92 | 95 | ||
93 | 96 | ||
94 | /* Must match option string! */ | 97 | /* Must match option string! */ |
@@ -1013,5 +1016,10 @@ int wget_main(int argc UNUSED_PARAM, char **argv) | |||
1013 | if (G.output_fd >= 0) | 1016 | if (G.output_fd >= 0) |
1014 | xclose(G.output_fd); | 1017 | xclose(G.output_fd); |
1015 | 1018 | ||
1019 | #if ENABLE_FEATURE_CLEAN_UP && ENABLE_FEATURE_WGET_LONG_OPTIONS | ||
1020 | free(G.extra_headers); | ||
1021 | #endif | ||
1022 | FINI_G(); | ||
1023 | |||
1016 | return EXIT_SUCCESS; | 1024 | return EXIT_SUCCESS; |
1017 | } | 1025 | } |