From a51cefc971eb5b7b6d15995257b68afdc32d4027 Mon Sep 17 00:00:00 2001 From: <> Date: Fri, 10 Mar 2017 17:40:03 -0800 Subject: [PATCH] Fixed issue w/ memory on 2 calls containing malloc --- main.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index 99ac890..5b9e1cb 100644 --- a/main.c +++ b/main.c @@ -77,7 +77,7 @@ void getquery(const char *qs) { // change from fseek/SEEK_END when sql queries are >2 GB in size. fseek(f, 0, SEEK_END); // go to the end of file unsigned int size = ftell(f); - qf = malloc(size); + qf = calloc(size, sizeof(char)); if (qf != NULL) { fseek(f, 0, SEEK_SET); // go to the start of file fread(qf, sizeof(char), size, f); @@ -85,7 +85,7 @@ void getquery(const char *qs) { } } qp = strchr(qs, '=') + 1; // increment to exclude '=' - printf("%s\n", qf); + printf("%x: \n\n%s\n", qf, qf); executequery(qf, qp, qt); free(qf); } @@ -108,4 +108,5 @@ void html(void) { int main(void) { getquery("map=pornstar-kaine"); + getquery("player=duHTyaSGpdTk7oebwPFoo899xPoTwP9bja4DUjCjTLo="); }