From 8e9a52ceae1f2e0fac76d06ff5e6a2170dcdd1bb Mon Sep 17 00:00:00 2001 From: Franklin Wei Date: Sun, 17 May 2015 17:23:18 -0400 Subject: fix some memory leaks --- src/sell.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/sell.c') diff --git a/src/sell.c b/src/sell.c index ae5fe0e..d390419 100644 --- a/src/sell.c +++ b/src/sell.c @@ -14,14 +14,17 @@ void sell_handler(struct player_t *player) if(!stock) { printf("Couldn't find '%s' in portfolio.\n", sym); + free(sym); return; } + free(sym); + printf("Updating prices...\n"); get_stock_info(stock->symbol, &stock->current_price, &stock->fullname); - printf("You currently own %llu shares of '%s' (%s) valued at $%llu.%02llu each.\n", + printf("You currently own %llu share(s) of '%s' (%s) valued at $%llu.%02llu each.\n", stock->count, stock->fullname, stock->symbol, stock->current_price.cents / 100, stock->current_price.cents % 100); printf("How many shares do you wish to sell? "); -- cgit v1.1