Fixed issue w/ memory on 2 calls containing malloc
This commit is contained in:
parent
34efe6ac4a
commit
a51cefc971
5
main.c
5
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=");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user