aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSteve Holme <steve_holme@hotmail.com>2014-02-02 13:58:35 +0000
committerSteve Holme <steve_holme@hotmail.com>2014-02-03 10:54:40 +0000
commitcf80b85b6636a110848e4fd666e28102b652b96a (patch)
tree5aa6b203507396c4a5c8b54efb839082aef9b07d /src
parent2f89a61cc05030561ffb994541bc3bf344e850fd (diff)
tool_main: Changed stack based config struct to be heap based
Diffstat (limited to 'src')
-rw-r--r--src/tool_main.c30
1 files changed, 21 insertions, 9 deletions
diff --git a/src/tool_main.c b/src/tool_main.c
index 5e58aff1d..e0766e9b7 100644
--- a/src/tool_main.c
+++ b/src/tool_main.c
@@ -33,6 +33,7 @@
#include "tool_cfgable.h"
#include "tool_convert.h"
+#include "tool_msgs.h"
#include "tool_operate.h"
#include "tool_panykey.h"
#include "tool_vms.h"
@@ -120,10 +121,7 @@ void memory_tracking_init(void)
int main(int argc, char *argv[])
{
int res;
- struct Configurable config;
-
- /* Initialise the config */
- init_config(&config);
+ struct Configurable *config;
main_checkfds();
@@ -134,15 +132,29 @@ int main(int argc, char *argv[])
/* Initialize memory tracking */
memory_tracking_init();
- /* Start our curl operation */
- res = operate(&config, argc, argv);
+ /* Allocate the initial config */
+ config = malloc(sizeof(struct Configurable));
+
+ if(config) {
+ /* Initialise the config */
+ init_config(config);
+
+ /* Start our curl operation */
+ res = operate(config, argc, argv);
#ifdef __SYMBIAN32__
- if(config.showerror)
- tool_pressanykey();
+ if(config->showerror)
+ tool_pressanykey();
#endif
- free_config_fields(&config);
+ /* Free the config structure */
+ free_config_fields(config);
+ Curl_safefree(config);
+ }
+ else {
+ helpf(stderr, "error initializing curl\n");
+ res = CURLE_FAILED_INIT;
+ }
#ifdef __NOVELL_LIBC__
if(getenv("_IN_NETWARE_BASH_") == NULL)