]> git.imager.perl.org - imager.git/blobdiff - io.c
- the convert, crop, rotate, copy, matrix_transform, to_paletted, to_rgb8,
[imager.git] / io.c
diff --git a/io.c b/io.c
index 9c705fae31c591fcaca6119be0373e8399d55946..5624361f163340a120e94e1d117ac98e72dc470a 100644 (file)
--- a/io.c
+++ b/io.c
@@ -115,12 +115,6 @@ mymalloc_file_line(size_t size, char* file, int line) {
   return buf;
 }
 
-
-
-
-
-
-
 void*
 myrealloc_file_line(void *ptr, size_t newsize, char* file, int line) {
   char *buf;
@@ -155,9 +149,6 @@ myrealloc_file_line(void *ptr, size_t newsize, char* file, int line) {
   return buf;
 }
 
-
-
-
 static
 void
 bndcheck(int idx) {
@@ -229,6 +220,11 @@ void*
 mymalloc(int size) {
   void *buf;
 
+  if (size < 0) {
+    fprintf(stderr, "Attempt to allocate size %d\n", size);
+    exit(3);
+  }
+
   if ( (buf = malloc(size)) == NULL ) {
     mm_log((1, "mymalloc: unable to malloc %d\n", size));
     fprintf(stderr,"Unable to malloc %d.\n", size); exit(3);