#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);
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;
}
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;
}
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;
}