diff --git a/src/binary_c_python_api.c b/src/binary_c_python_api.c index 01fc7438e33d0641b96efe35db28a91463abccec..3f0938d0b17983610a4e1d17e90a98ff5bec1aeb 100644 --- a/src/binary_c_python_api.c +++ b/src/binary_c_python_api.c @@ -116,9 +116,15 @@ int run_system(char * argstring, /* set raw_buffer_size = -1 to prevent it being freed */ stardata->tmpstore->raw_buffer_size = -1; - + /* free stardata (except the buffer) */ - binary_c_free_memory(&stardata,TRUE,TRUE,FALSE,FALSE); // CHeck if this is good for single runs.. TODO: + binary_c_free_memory(&stardata, // Stardata + TRUE, // free_preferences + TRUE, // free_stardata + FALSE, // free_store + FALSE // free_raw_buffer + ); + // add flag or logic to free store contents. if (store_memaddr == -1) @@ -177,9 +183,16 @@ int return_arglines(char ** const buffer, /* set raw_buffer_size = -1 to prevent it being freed */ stardata->tmpstore->raw_buffer_size = -1; - + /* free stardata (except the buffer) */ - binary_c_free_memory(&stardata,TRUE,TRUE,FALSE,FALSE); + binary_c_free_memory(&stardata, // Stardata + TRUE, // free_preferences + TRUE, // free_stardata + FALSE, // free_store + FALSE // free_raw_buffer + ); + + // TODO: check what this does binary_c_free_store_contents(store); return 0; @@ -221,7 +234,14 @@ int return_help_info(char * argstring, stardata->tmpstore->raw_buffer_size = -1; /* free stardata (except the buffer) */ - binary_c_free_memory(&stardata,TRUE,TRUE,FALSE,FALSE); + binary_c_free_memory(&stardata, // Stardata + TRUE, // free_preferences + TRUE, // free_stardata + FALSE, // free_store + FALSE // free_raw_buffer + ); + + // Ask rob whether this can be replaced with setting the thing above to true binary_c_free_store_contents(store); return 0; } @@ -262,7 +282,14 @@ int return_help_all_info(char ** const buffer, stardata->tmpstore->raw_buffer_size = -1; /* free stardata (except the buffer) */ - binary_c_free_memory(&stardata,TRUE,TRUE,FALSE,FALSE); + binary_c_free_memory(&stardata, // Stardata + TRUE, // free_preferences + TRUE, // free_stardata + FALSE, // free_store + FALSE // free_raw_buffer + ); + + binary_c_free_store_contents(store); return 0; } @@ -301,9 +328,15 @@ int return_version_info(char ** const buffer, /* set raw_buffer_size = -1 to prevent it being freed */ stardata->tmpstore->raw_buffer_size = -1; - + /* free stardata (except the buffer) */ - binary_c_free_memory(&stardata,TRUE,TRUE,FALSE,FALSE); + binary_c_free_memory(&stardata, // Stardata + TRUE, // free_preferences + TRUE, // free_stardata + FALSE, // free_store + FALSE // free_raw_buffer + ); + binary_c_free_store_contents(store); return 0; } @@ -344,7 +377,12 @@ long int return_store(char * argstring, stardata->tmpstore->raw_buffer_size = -1; /* free stardata (except the buffer) */ - binary_c_free_memory(&stardata, TRUE, TRUE, FALSE, FALSE); + binary_c_free_memory(&stardata, // Stardata + TRUE, // free_preferences + TRUE, // free_stardata + FALSE, // free_store + FALSE // free_raw_buffer + ); /* convert the pointer */ uintptr_t store_memaddr_int = (uintptr_t)store; // C Version converting ptr to int