From: sparky4 Date: Tue, 24 Mar 2015 16:46:07 +0000 (-0500) Subject: Bump into issue with allocating pcx file buffer~ ><; but file reading is good but... X-Git-Url: http://4ch.mooo.com/gitweb/?a=commitdiff_plain;h=6e77b2ef1d9df8ba83f9d378c21c96289d47bf11;p=16.git Bump into issue with allocating pcx file buffer~ ><; but file reading is good but it gives wanings ><; modified: scroll.exe modified: src/lib/bitmap.c modified: src/lib/mapread.c --- diff --git a/scroll.exe b/scroll.exe index d801e2e6..8d5085d0 100644 Binary files a/scroll.exe and b/scroll.exe differ diff --git a/src/lib/bitmap.c b/src/lib/bitmap.c index ece5f07d..e6a0adb8 100644 --- a/src/lib/bitmap.c +++ b/src/lib/bitmap.c @@ -75,7 +75,7 @@ bitmapLoadPcx(char *filename) { bitmap_t result; long bufSize; int index; - byte count, val; + byte count, val; /* open the PCX file for reading */ file = fopen(filename, "rb"); @@ -85,11 +85,11 @@ bitmapLoadPcx(char *filename) { } /* load the first part of the pcx file */ - loadPcxStage1(file, &result); + loadPcxStage1(file, &result); /* allocate the buffer */ - bufSize = result.width * result.height; - result.data = malloc(bufSize); + bufSize = result.width * result.height; + result.data = malloc(bufSize); //it breaks right here~ if(!result.data) { printf("Could not allocate memory for bitmap data."); fclose(file); diff --git a/src/lib/mapread.c b/src/lib/mapread.c index 6a947d67..cd4f5c30 100644 --- a/src/lib/mapread.c +++ b/src/lib/mapread.c @@ -164,14 +164,14 @@ again: } } else { //printf("================================================================================%s================================================================================", js); - js_sv=malloc(sizeof(char)*10); + //js_sv=malloc(sizeof(char)*10); dump(js, tok, p.toknext, 0, map, 0); eof_expected = 1; } } - //free(js); - //free(tok); + free(js); + free(tok); fclose(fh); return 0;