X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fmain.c;h=31e8a71ec5ed45f80ebc20ccaa11b0700cc897b5;hb=56d0fddeeaee0ecb56cddc09db44bb87bf011314;hp=9367eca67d2856c4326fec25eff5a51e8dafedda;hpb=773592751bbdef2f304725b24f620f89c9d4a5eb;p=dos_imgv diff --git a/src/main.c b/src/main.c index 9367eca..31e8a71 100644 --- a/src/main.c +++ b/src/main.c @@ -5,6 +5,7 @@ #include "video.h" #include "mouse.h" #include "imago2.h" +#include "chkalloc.h" int switch_mode(int m); int find_best_mode(int minx, int miny); @@ -62,7 +63,7 @@ int main(int argc, char **argv) num = num_video_modes(); vmodes = video_modes(); - if(!(vmlist = malloc(num * sizeof *vmlist))) { + if(!(vmlist = chk_malloc(num * sizeof *vmlist))) { fprintf(stderr, "failed to allocate video mode list\n"); return 1; } @@ -155,12 +156,13 @@ int main(int argc, char **argv) end: img_destroy(&img); - free(backbuf); - free(vmlist); + chk_free(backbuf); + chk_free(vmlist); if(cur_vm >= 0) { set_text_mode(); } cleanup_video(); + chk_check(); return 0; } @@ -169,8 +171,8 @@ int switch_mode(int m) vmode = vmlist + m; cur_vm = m; - free(backbuf); - if(!(backbuf = malloc(vmode->ysz * vmode->pitch))) { + chk_free(backbuf); + if(!(backbuf = chk_malloc(vmode->ysz * vmode->pitch))) { fprintf(stderr, "failed to allocate back buffer\n"); return -1; }