[FFmpeg-devel] Memory leak in rtmp_open()

Michael Niedermayer michaelni at gmx.at
Tue Jan 14 02:00:04 CET 2014


On Tue, Jan 14, 2014 at 02:31:24AM +0200, Andrey Myznikov wrote:
> On 01/13/2014 11:56 PM, Michael Niedermayer wrote:
> >On Mon, Jan 13, 2014 at 02:13:48PM +0200, Andrey Myznikov wrote:
> >>Hello all,
> >>     attached is little path to libavformat/librtmp.c fixes potential
> >>memory and socket loss in rtmp_open().
> >>The reason is that RTMP_ConnectStream() does not call to
> >>RTMP_Close() on error.
> >>Observed actually with trial version of Adobe Flash Media Server
> >>limiting number of simultaneous connections.
> >its not safe to call RTMP_Close() on the fail: path ?
> >iam asking as this would be simpler
> >
> >[...]
> 
> RTMP_Close() may free() some NULL pointers in "r" structure if
> RTMP_Connect() was not successfull,
> but according to
>     $ man 3 free
> "If |ptr| is a null pointer, no action occurs".
> 
> Therefore  you are right - it should be safe, after adding a check
> for rc value:
> fail:
> if ( rc != 0 ) {
>     RTMP_Close(r);
> }

applied

thanks

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

it is not once nor twice but times without number that the same ideas make
their appearance in the world. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140114/ad3eedb0/attachment.asc>


More information about the ffmpeg-devel mailing list