aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar jonas <himself@jonasgunz.de> 2019-02-19 02:21:04 +0100
committerGravatar jonas <himself@jonasgunz.de> 2019-02-19 02:21:04 +0100
commit98b585ee26f14ea0927386f26200a2e641272bb9 (patch)
tree6a3ef3465d8092c7bd8ddc5f034dc8da72449806
parent6b2d40b0d5d62546fe0676c8268ca7857a41815c (diff)
downloadAsciiMap-98b585ee26f14ea0927386f26200a2e641272bb9.tar.gz
Further memory leak fixes
-rw-r--r--bitmap.c2
-rw-r--r--main.c14
2 files changed, 14 insertions, 2 deletions
diff --git a/bitmap.c b/bitmap.c
index 11554e7..a99e335 100644
--- a/bitmap.c
+++ b/bitmap.c
@@ -40,6 +40,8 @@ struct bitmap_pixel_data bitmap_read(char *_file)
ret = bitmap_read_pixel_data(bitmap, header);
+
+ free(header.tables);
fclose(bitmap);
ret.error = 0;
diff --git a/main.c b/main.c
index 0f99ad3..f0803ca 100644
--- a/main.c
+++ b/main.c
@@ -59,7 +59,7 @@ int main(int argc, char *argv[])
if(bitmap.error)
{
- printf("Error reading file");
+ printf("Error reading file\n");
return 1;
}
@@ -131,10 +131,20 @@ int main(int argc, char *argv[])
//Cleanup
- for(int i = 0; i < size_y; i++)
+ for(int i = 0; i < size_x; i++)
free (ascii_buff[i]);
free(ascii_buff);
+ for(int i = 0; i < bitmap.x; i++)
+ {
+ free(bitmap.R[i]);
+ free(bitmap.G[i]);
+ free(bitmap.B[i]);
+ }
+ free(bitmap.R);
+ free(bitmap.G);
+ free(bitmap.B);
+
fclose(out);
return 0;