From 49e6514a3d8efe34d315bd63ded613daee925d10 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Fri, 20 Aug 2021 18:54:34 +0100 Subject: [PATCH] u/sink: Make sure to free frame when we fail to decode --- src/xrt/auxiliary/util/u_sink_converter.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/xrt/auxiliary/util/u_sink_converter.c b/src/xrt/auxiliary/util/u_sink_converter.c index 0db0e6221..634d122eb 100644 --- a/src/xrt/auxiliary/util/u_sink_converter.c +++ b/src/xrt/auxiliary/util/u_sink_converter.c @@ -480,6 +480,8 @@ convert_frame_r8g8b8_or_l8(struct xrt_frame_sink *xs, struct xrt_frame *xf) return; } if (!from_MJPEG_to_R8G8B8(converted, xf->size, xf->data)) { + // Make sure to free frame when we fail to decode. + xrt_frame_reference(&converted, NULL); return; } break; @@ -530,6 +532,8 @@ convert_frame_r8g8b8_bayer_or_l8(struct xrt_frame_sink *xs, struct xrt_frame *xf return; } if (!from_MJPEG_to_R8G8B8(converted, xf->size, xf->data)) { + // Make sure to free frame when we fail to decode. + xrt_frame_reference(&converted, NULL); return; } break; @@ -586,6 +590,8 @@ convert_frame_r8g8b8(struct xrt_frame_sink *xs, struct xrt_frame *xf) return; } if (!from_MJPEG_to_R8G8B8(converted, xf->size, xf->data)) { + // Make sure to free frame when we fail to decode. + xrt_frame_reference(&converted, NULL); return; } break;