}
decoder = wcap_decoder_create(argv[1]);
+ if (decoder == NULL) {
+ fprintf(stderr, "Creating wcap decoder failed\n");
+ exit(EXIT_FAILURE);
+ }
if (yuv4mpeg2 && isatty(1)) {
fprintf(stderr, "Not dumping yuv4mpeg2 data to terminal. Pipe output to a file or a process.\n");
decoder->size = buf.st_size;
decoder->map = mmap(NULL, decoder->size,
PROT_READ, MAP_PRIVATE, decoder->fd, 0);
+ if (decoder->map == MAP_FAILED) {
+ fprintf(stderr, "mmap failed\n");
+ free(decoder);
+ return NULL;
+ }
header = decoder->map;
decoder->format = header->format;
frame_size = header->width * header->height * 4;
decoder->frame = malloc(frame_size);
+ if (decoder->frame == NULL) {
+ free(decoder);
+ return NULL;
+ }
memset(decoder->frame, 0, frame_size);
return decoder;