aboutsummaryrefslogtreecommitdiff
path: root/src/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/util.c b/src/util.c
index 2754fc5..eccdef5 100644
--- a/src/util.c
+++ b/src/util.c
@@ -74,7 +74,8 @@ bool get_stock_info(char *symbol, struct money_t *price, char **name_ret)
/** now parse the data **/
- char ** ptr = &buf.data;
+ char *p1 = buf.data;
+ char ** ptr = &p1;
*name_ret = csv_read(ptr);
@@ -83,9 +84,11 @@ bool get_stock_info(char *symbol, struct money_t *price, char **name_ret)
/* dirty hack! */
sscanf(pricebuf, "%llu.%2llu", &dollars, &cents);
+ free(pricebuf);
price->cents = dollars * 100 + cents;
+ free(buf.data);
return true;
}