diff options
author | jonas <himself@jonasgunz.de> | 2019-02-19 02:10:41 +0100 |
---|---|---|
committer | jonas <himself@jonasgunz.de> | 2019-02-19 02:10:41 +0100 |
commit | 6b2d40b0d5d62546fe0676c8268ca7857a41815c (patch) | |
tree | e077dbc5c05c8b81ba9f599b54ae336abe6f8b0f /bitmap.c | |
parent | 76d8bd47c6f6a47742c986ad9146e6ae59fca053 (diff) | |
download | AsciiMap-6b2d40b0d5d62546fe0676c8268ca7857a41815c.tar.gz |
Fixed picture flipping + memory leaks
Diffstat (limited to 'bitmap.c')
-rw-r--r-- | bitmap.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -20,6 +20,7 @@ struct bitmap_pixel_data bitmap_read(char *_file) struct bitmap_file_header header; ret.R = ret.G = ret.B = NULL; + ret.error = 1; FILE *bitmap = fopen(_file,"r"); @@ -41,6 +42,7 @@ struct bitmap_pixel_data bitmap_read(char *_file) fclose(bitmap); + ret.error = 0; return ret; } @@ -129,7 +131,7 @@ struct bitmap_pixel_data bitmap_read_pixel_data(FILE *_file, struct bitmap_file_ ret.R = malloc(sizeof(*ret.R) * ret.x); ret.G = malloc(sizeof(*ret.G) * ret.x); ret.B = malloc(sizeof(*ret.B) * ret.x); - for(int i = 0; i < ret.y; i++) + for(int i = 0; i < ret.x; i++) { ret.R[i] = malloc(sizeof(*ret.R[i]) * ret.y); ret.G[i] = malloc(sizeof(*ret.G[i]) * ret.y); |