Delete image if image_index == -1
This commit is contained in:
parent
197f9bdd9e
commit
3f2d088f8c
|
@ -76,6 +76,10 @@ ZMPacket::~ZMPacket() {
|
|||
analysis_image = nullptr;
|
||||
}
|
||||
// We assume the image was allocated elsewhere, so we just unref it.
|
||||
if ( image_index == -1 ) {
|
||||
delete image;
|
||||
delete timestamp;
|
||||
}
|
||||
image = nullptr;
|
||||
timestamp = nullptr;
|
||||
}
|
||||
|
@ -148,6 +152,8 @@ int ZMPacket::decode(AVCodecContext *ctx) {
|
|||
if ( ret < 0 ) {
|
||||
Error("Unable to receive frame: %s", av_make_error_string(ret).c_str());
|
||||
av_frame_free(&in_frame);
|
||||
Error("Unable to receive frame: %s %p", av_make_error_string(ret).c_str(), in_frame);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue