Module: libav
Branch: master
Commit: 06ebc0bf9a6401733a4ce1310325de19f631819a

Author:    Martin Storsjö <[email protected]>
Committer: Martin Storsjö <[email protected]>
Date:      Thu Sep 26 16:34:04 2013 +0300

lavf: Allocate arrays with av_realloc if they will be realloced later

Pointers returned from av_malloc can't in general be passed
to av_realloc.

Signed-off-by: Martin Storsjö <[email protected]>

---

 libavformat/concat.c    |    2 +-
 libavformat/rtpdec_qt.c |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavformat/concat.c b/libavformat/concat.c
index 4682d8a..416bbf5 100644
--- a/libavformat/concat.c
+++ b/libavformat/concat.c
@@ -74,7 +74,7 @@ static av_cold int concat_open(URLContext *h, const char 
*uri, int flags)
                 return AVERROR(ENAMETOOLONG);
             }
 
-    if (!(nodes = av_malloc(sizeof(*nodes) * len))) {
+    if (!(nodes = av_realloc(NULL, sizeof(*nodes) * len))) {
         return AVERROR(ENOMEM);
     } else
         data->nodes = nodes;
diff --git a/libavformat/rtpdec_qt.c b/libavformat/rtpdec_qt.c
index 8898f05..bb0a73b 100644
--- a/libavformat/rtpdec_qt.c
+++ b/libavformat/rtpdec_qt.c
@@ -179,7 +179,7 @@ static int qt_rtp_parse_packet(AVFormatContext *s, 
PayloadContext *qt,
         } else {
             av_freep(&qt->pkt.data);
             av_init_packet(&qt->pkt);
-            qt->pkt.data = av_malloc(alen + FF_INPUT_BUFFER_PADDING_SIZE);
+            qt->pkt.data = av_realloc(NULL, alen + 
FF_INPUT_BUFFER_PADDING_SIZE);
             if (!qt->pkt.data)
                 return AVERROR(ENOMEM);
             qt->pkt.size = 0;
@@ -213,7 +213,7 @@ static int qt_rtp_parse_packet(AVFormatContext *s, 
PayloadContext *qt,
         pkt->stream_index = st->index;
         if (qt->remaining > 0) {
             av_freep(&qt->pkt.data);
-            qt->pkt.data = av_malloc(qt->remaining * qt->bytes_per_frame);
+            qt->pkt.data = av_realloc(NULL, qt->remaining * 
qt->bytes_per_frame);
             if (!qt->pkt.data) {
                 av_free_packet(pkt);
                 return AVERROR(ENOMEM);

_______________________________________________
libav-commits mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-commits

Reply via email to