Fix v4l2 AVPacket memory leak on error

Unref v4l2 AVPacket even if writing failed.
master
Romain Vimont 5 years ago
parent 1cde68a1fa
commit 84f17fdeab

@ -92,11 +92,11 @@ encode_and_write_frame(struct sc_v4l2_sink *vs, const AVFrame *frame) {
// A packet was received
bool ok = write_packet(vs, packet);
av_packet_unref(packet);
if (!ok) {
LOGW("Could not send packet to v4l2 sink");
return false;
}
av_packet_unref(packet);
} else if (ret != AVERROR(EAGAIN)) {
LOGE("Could not receive v4l2 video packet: %d", ret);
return false;

Loading…
Cancel
Save