projects
/
dos_imgv
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
check alloc
[dos_imgv]
/
src
/
main.c
diff --git
a/src/main.c
b/src/main.c
index
9367eca
..
31e8a71
100644
(file)
--- a/
src/main.c
+++ b/
src/main.c
@@
-5,6
+5,7
@@
#include "video.h"
#include "mouse.h"
#include "imago2.h"
#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);
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();
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;
}
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);
end:
img_destroy(&img);
- free(backbuf);
- free(vmlist);
+ chk_free(backbuf);
+ chk_free(vmlist);
if(cur_vm >= 0) {
set_text_mode();
}
cleanup_video();
if(cur_vm >= 0) {
set_text_mode();
}
cleanup_video();
+ chk_check();
return 0;
}
return 0;
}
@@
-169,8
+171,8
@@
int switch_mode(int m)
vmode = vmlist + m;
cur_vm = 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;
}
fprintf(stderr, "failed to allocate back buffer\n");
return -1;
}