diff --git a/src/decoder.rs b/src/decoder.rs index c432929..b20e1f4 100644 --- a/src/decoder.rs +++ b/src/decoder.rs @@ -130,7 +130,9 @@ impl VP9Decoder { match ret { VPX_CODEC_OK => Ok(()), _ => { - let _ = unsafe { Box::from_raw(priv_data) }; + if !priv_data.is_null() { + let _ = unsafe { Box::from_raw(priv_data) }; + } Err(ret) } }