[FFmpeg-cvslog] avformat/hdsenc: Use av_freep() avoid leaving stale pointers in memory

Michael Niedermayer git at videolan.org
Tue Jan 20 03:36:17 CET 2015


ffmpeg | branch: release/2.2 | Michael Niedermayer <michaelni at gmx.at> | Tue Dec 16 15:01:05 2014 +0100| [de434423910efaee8c2d02a49a91ef3f0ab516ee] | committer: Michael Niedermayer

avformat/hdsenc: Use av_freep() avoid leaving stale pointers in memory

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit 16d763fa45b95783c6770edc559769d9a83d6a10)

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=de434423910efaee8c2d02a49a91ef3f0ab516ee
---

 libavformat/hdsenc.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/libavformat/hdsenc.c b/libavformat/hdsenc.c
index fb0a948..cb3a3ff 100644
--- a/libavformat/hdsenc.c
+++ b/libavformat/hdsenc.c
@@ -145,15 +145,15 @@ static void hds_free(AVFormatContext *s)
         if (os->ctx && os->ctx_inited)
             av_write_trailer(os->ctx);
         if (os->ctx && os->ctx->pb)
-            av_free(os->ctx->pb);
+            av_freep(&os->ctx->pb);
         if (os->ctx)
             avformat_free_context(os->ctx);
-        av_free(os->metadata);
+        av_freep(&os->metadata);
         for (j = 0; j < os->nb_extra_packets; j++)
-            av_free(os->extra_packets[j]);
+            av_freep(&os->extra_packets[j]);
         for (j = 0; j < os->nb_fragments; j++)
-            av_free(os->fragments[j]);
-        av_free(os->fragments);
+            av_freep(&os->fragments[j]);
+        av_freep(&os->fragments);
     }
     av_freep(&c->streams);
 }
@@ -509,7 +509,7 @@ static int hds_flush(AVFormatContext *s, OutputStream *os, int final,
         if (remove > 0) {
             for (i = 0; i < remove; i++) {
                 unlink(os->fragments[i]->file);
-                av_free(os->fragments[i]);
+                av_freep(&os->fragments[i]);
             }
             os->nb_fragments -= remove;
             memmove(os->fragments, os->fragments + remove,



More information about the ffmpeg-cvslog mailing list