Commit 742e4cfe authored by denis's avatar denis

fixed couple of memory leaks

parent 2d84ac60
Pipeline #127576564 passed with stage
in 1 minute and 20 seconds
......@@ -73,7 +73,8 @@ class_sl_record *class_sl_record_init(char* quote_symbol, unsigned int nr_record
// init data
*self->buydate = bfromcstr(buydate);
*self->selldate = bfromcstr("0000-00-00");
char tmp_selldate[] = "0000-00-00";
*self->selldate = bfromcstr(tmp_selldate);
*self->stoploss_type = bfromcstr(stoploss_type);
// set methods
......
......@@ -2116,7 +2116,7 @@ int mysql_update_account(float *cash, float *equity, float *risk_free_equity, fl
{
// prepare first part of query
bstring querystring=bfromcstr("INSERT INTO account (variable_name, value) VALUES ('cash',");
bstring query0,query1,query2,query3,query4, query8, query9, query10;
bstring query0,query1,query2,query3,query4, query8, query9, query10, query11;
bstring query5, query7;
query0 = bformat("%f", *cash);
bconcat(querystring, query0);
......@@ -2134,7 +2134,8 @@ int mysql_update_account(float *cash, float *equity, float *risk_free_equity, fl
bconcat(querystring, query9);
query10 = bfromcstr("), ('all_time_high' , ");
bconcat(querystring, query10);
bconcat(querystring, bformat("%f", *high));
query11 = bformat("%f", *high);
bconcat(querystring, query11);
query5 = bfromcstr(") , ('virgin_flag',");
bconcat(querystring, query5);
query7 = bfromcstr("0) ON DUPLICATE KEY UPDATE value=VALUES(value);");
......@@ -2159,6 +2160,7 @@ int mysql_update_account(float *cash, float *equity, float *risk_free_equity, fl
bdestroy(query8);
bdestroy(query9);
bdestroy(query10);
bdestroy(query11);
bdestroy(functionname);
return EXIT_SUCCESS;
......
......@@ -709,7 +709,7 @@ int execution_manager(class_accounts *the_account, class_market_list *market_lis
performance_total_high->QuoteObj->setQuoteTupel(performance_total_high->QuoteObj, performance_idx, current_date, current_day,the_account->allTimeHigh);
performance_idx = performance_idx + 1;
free_1d_array_bstring(current_date,1);
} // end of loop through execution period
// dump al SL data to db
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment