Diffstat (limited to 'noncore/todayplugins/stockticker/libstocks/stocks.c') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/todayplugins/stockticker/libstocks/stocks.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/noncore/todayplugins/stockticker/libstocks/stocks.c b/noncore/todayplugins/stockticker/libstocks/stocks.c index eb04ba9..3a26a47 100644 --- a/noncore/todayplugins/stockticker/libstocks/stocks.c +++ b/noncore/todayplugins/stockticker/libstocks/stocks.c @@ -237,7 +237,6 @@ libstocks_return_code get_stocks(const char *stocks, stock **stock_datas) switch (source) { case YAHOO_US: - if (us_quotes) { lgr_us_quotes = strlen(us_quotes); @@ -246,8 +245,8 @@ libstocks_return_code get_stocks(const char *stocks, stock **stock_datas) us_quotes_temp = malloc(lgr_us_quotes + lgr_symbol +2); if(us_quotes_temp==NULL) { - fprintf(stderr,"Memory allocating error (%s line %d)\n" - ,__FILE__, __LINE__); + fprintf(stderr,"Memory allocating error (%s line %d)\n", + __FILE__, __LINE__); exit(1); } strcpy(us_quotes_temp, us_quotes); @@ -263,8 +262,8 @@ libstocks_return_code get_stocks(const char *stocks, stock **stock_datas) if(us_quotes==NULL) { - fprintf(stderr,"Memory allocating error (%s line %d)\n" - ,__FILE__, __LINE__); + fprintf(stderr,"Memory allocating error (%s line %d)\n", + __FILE__, __LINE__); exit(1); } strcpy(us_quotes, symbol); @@ -273,7 +272,6 @@ libstocks_return_code get_stocks(const char *stocks, stock **stock_datas) break; case YAHOO_EUROPE: - if (eu_quotes) { lgr_eu_quotes = strlen(eu_quotes); @@ -282,8 +280,8 @@ libstocks_return_code get_stocks(const char *stocks, stock **stock_datas) eu_quotes_temp = malloc(lgr_eu_quotes + lgr_symbol +2); if(eu_quotes_temp==NULL) { - fprintf(stderr,"Memory allocating error (%s line %d)\n" - ,__FILE__, __LINE__); + fprintf(stderr,"Memory allocating error (%s line %d)\n", + __FILE__, __LINE__); exit(1); } strcpy(eu_quotes_temp, eu_quotes); @@ -298,8 +296,8 @@ libstocks_return_code get_stocks(const char *stocks, stock **stock_datas) eu_quotes = malloc(strlen(symbol)+1); if(eu_quotes==NULL) { - fprintf(stderr,"Memory allocating error (%s line %d)\n" - ,__FILE__, __LINE__); + fprintf(stderr,"Memory allocating error (%s line %d)\n", + __FILE__, __LINE__); exit(1); } strcpy(eu_quotes, symbol); @@ -314,6 +312,7 @@ libstocks_return_code get_stocks(const char *stocks, stock **stock_datas) { /* Gets us quotes */ error = download_stocks(us_quotes, &stocks_tmp, YAHOO_US); + free(us_quotes); if (error) return error; } @@ -321,6 +320,7 @@ libstocks_return_code get_stocks(const char *stocks, stock **stock_datas) { /* Gets european quotes */ error = download_stocks(eu_quotes, &stocks_getted, YAHOO_EUROPE); + free(eu_quotes); if (error) return error; /* concats lists if needed */ @@ -338,7 +338,8 @@ libstocks_return_code get_stocks(const char *stocks, stock **stock_datas) stocks_getted->PreviousStock = last_stock; } - else (stocks_tmp = stocks_getted); + else + (stocks_tmp = stocks_getted); } *stock_datas = stocks_tmp; |