--- test.c.orig 2015-04-07 13:16:31.699798616 -0700 +++ test.c 2015-04-07 13:18:43.828591506 -0700 @@ -120,6 +120,9 @@ } test->buf = malloc(buf.st_size * clone_count + clone_count - 1); + if (test->buf == NULL) { + return -1; + } test->len = 0; test->pos = 0;