[FFmpeg-devel] Memory leaks in libavformat/segment.c

Michael Niedermayer michaelni at gmx.at
Sat Dec 12 23:17:22 CET 2015


On Tue, Dec 08, 2015 at 07:29:13PM +0800, Lvqier wrote:
> On 12/8/15 7:05 PM, Hendrik Leppkes wrote:
> >On Tue, Dec 8, 2015 at 11:46 AM, Lvqier <lvqier at gmail.com> wrote:
> >>On 12/8/15 6:26 PM, Hendrik Leppkes wrote:
> >>>On Tue, Dec 8, 2015 at 11:19 AM, Lvqier <lvqier at gmail.com> wrote:
> >>>>Hi Hendrik,
> >>>>
> >>>>      The attached is another patch which uses av_reallocp to fix this
> >>>>issue.
> >>>>
> >>>Thanks, that looks almost good. But you should check for a negative
> >>>return value, as all errors are negative.
> >>Do you mean that the set_segment_filename function should return the value
> >>which returns from av_reallocp instead of AVERROR(ENOMEM) when it fails?
> >That would be an option too, but right now you just do
> >if(av_reallop(..)), at the least this should be if (av_reallocp(...) <
> >0)
> >
> >or even better:
> >ret = av_reallocp(...);
> >if (ret < 0)
> >     return ret;
> Thank you, I will follow your advice. Please help review this
> version. I have studied some code where av_reallocp is used before
> sending it out.
> >
> >- Hendrik
> >_______________________________________________
> >ffmpeg-devel mailing list
> >ffmpeg-devel at ffmpeg.org
> >http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> -- 
> /Best Regards,
> lvqier - lvqier at gmail.com <mailto:lvqier at gmail.com>
> /
> 
> ******************************************
> 青春如烟,唱一首笑忘歌
> 

>  segment.c |    6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 1937242a893d87f41f4a8feed2e176ce705987b1  patch_v4.diff
> diff --git a/libavformat/segment.c b/libavformat/segment.c

applied

thanks


[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The misfortune of the wise is better than the prosperity of the fool.
-- Epicurus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20151212/479c42e8/attachment.sig>


More information about the ffmpeg-devel mailing list