Motion - Bug Report 2014x 12x 10x 101759
You are here: Foswiki>Motion Web>BugReports>BugReport2014x12x10x101759 (10 Dec 2014, ChristopheGRENIER)Edit Attach

BUG: Fix for mem leak in read_rtsp_image()

There is a memory leak in the error path of read_rtsp_image(). It has triggered an Out of Memory. Patch included.
diff -rup motion/netcam_rtsp.c motion.cgr/netcam_rtsp.c
--- motion/netcam_rtsp.c   2014-11-28 16:15:08.172190280 +0100
+++ motion.cgr/netcam_rtsp.c   2014-12-10 10:27:36.444406204 +0100
@@ -258,6 +258,8 @@ int netcam_read_rtsp_image(netcam_contex
   if (size_decoded == 0) {
     // something went wrong, end of stream?
     MOTION_LOG(ERR, TYPE_NETCAM, SHOW_ERRNO, "%s: invalid frame!");
+    av_free_packet(&packet);
+    av_free(frame);
     return -1;
   }
 

Environment

Motion version: Git-28b7cb2a4297c78b9c08c9ce29a648aeb22120d0
ffmpeg version: 2.1.6
Shared libraries: ffmpeg
Server OS: CentOS 6.6
-- ChristopheGRENIER - 10 Dec 2014

Follow up

Fix record

Topic revision: r1 - 10 Dec 2014, ChristopheGRENIER
Copyright © 1999-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Please do not email Kenneth for support questions (read why). Use the Support Requests page or join the Mailing List.
This website only use harmless session cookies. See Cookie Policy for details. By using this website you accept the use of these cookies.