if (avcodec_parameters_to_context(pVideoCodecCtx, pVideoCodecPar) < 0) {
debug_error(DEBUG, "error: avcodec_parameters_to_context");
+ avcodec_free_context(&pVideoCodecCtx);
return false;
}
pVideoCodecCtx->thread_count = 0;
if (avcodec_open2(pVideoCodecCtx, pVideoCodec, NULL) < 0) {
debug_error(DEBUG, "error : avcodec_open failed");
+ avcodec_free_context(&pVideoCodecCtx);
return false;
}
}
pIOCtx = avio_alloc_context(avio_ctx_buffer, MMFILE_AVIO_BUFFER_LEN, 0, handle, __mmf_mem_read, NULL, __mmf_mem_seek);
- if (pIOCtx == NULL) {
- debug_error(DEBUG, "error: cannot alloc io context");
+ if (!pIOCtx) {
+ debug_error(DEBUG, "failed to avio_alloc_context");
av_free(avio_ctx_buffer);
mmfile_free(handle);
ret = MMFILE_FORMAT_FAIL;
pFormatCtx = avformat_alloc_context();
if (!pFormatCtx) {
- debug_warning(DEBUG, "failed to avformat_alloc_context");
+ debug_error(DEBUG, "failed to avformat_alloc_context");
ret = MMFILE_FORMAT_FAIL;
goto exception;
}