diff --git a/src/scan.c b/src/scan.c index 85b36b3..feff3d6 100644 --- a/src/scan.c +++ b/src/scan.c @@ -199,6 +199,9 @@ int scan_file(const char *file, unsigned index) { packet.size = buffer_size; swr = swr_alloc(); + if (swr == NULL){ + fail_printf("unable to allocate memory fro SwrContext"); + } *ebur128 = ebur128_init( ctx -> channels, ctx -> sample_rate, @@ -436,8 +439,14 @@ static void scan_frame(ebur128_state *ebur128, AVFrame *frame, out_size = av_samples_get_buffer_size( &out_linesize, frame -> channels, frame -> nb_samples, out_fmt, 0 ); + if (out_size < 0){ + fail_printf("av_samples_get_buffer_size() failed with return code %d", out_size); + } out_data = av_malloc(out_size); + if (out_data == NULL){ + fail_printf("av_malloc failed to allocate memory"); + } if (swr_convert( swr, (uint8_t**) &out_data, frame -> nb_samples,