Skip to content

Commit ffc4e2f

Browse files
committed
Fix some minor memorly leaks for mjpeg
Signed-off-by: Evan Flynn <[email protected]>
1 parent a54cccb commit ffc4e2f

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

include/usb_cam/formats/mjpeg.hpp

+9-4
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,15 @@ class MJPEG2RGB : public pixel_format_base
145145

146146
~MJPEG2RGB()
147147
{
148+
if (m_averror_str) {
149+
free(m_averror_str);
150+
}
151+
if (m_avoptions) {
152+
free(m_avoptions);
153+
}
154+
if (m_avpacket) {
155+
free(m_avpacket);
156+
}
148157
if (m_avcodec_context) {
149158
avcodec_close(m_avcodec_context);
150159
avcodec_free_context(&m_avcodec_context);
@@ -155,10 +164,6 @@ class MJPEG2RGB : public pixel_format_base
155164
if (m_avframe_rgb) {
156165
av_frame_free(&m_avframe_rgb);
157166
}
158-
if (m_avpacket) {
159-
av_packet_unref(m_avpacket);
160-
av_packet_free(&m_avpacket);
161-
}
162167
if (m_avparser) {
163168
av_parser_close(m_avparser);
164169
}

0 commit comments

Comments
 (0)