[FFmpeg-cvslog] lavfi: fix realloc size computation in avfilter_add_format()

Stefano Sabatini git at videolan.org
Mon Mar 19 05:30:20 CET 2012


ffmpeg | branch: release/0.8 | Stefano Sabatini <stefano.sabatini-lala at poste.it> | Sun Jun 19 22:07:18 2011 +0200| [958e0f705dab60f4d11ab90e2ebe2b4e7393fb41] | committer: Reinhard Tartler

lavfi: fix realloc size computation in avfilter_add_format()

Replace sizeof((*avff)->formats)
with    sizeof(*(*avff)->formats)

as the size of the array element is given by the pointed element
rather than by its pointer.

In particular fix computation with the pending patch when
sizeof(int64_t) != sizeof(int64_t *).

Signed-off-by: Anton Khirnov <anton at khirnov.net>
(cherry picked from commit 0ec56d1144fa4ea36950295987bb5f49c9747046)

Signed-off-by: Anton Khirnov <anton at khirnov.net>
Signed-off-by: Reinhard Tartler <siretart at tauware.de>

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

 libavfilter/formats.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/libavfilter/formats.c b/libavfilter/formats.c
index bb7b921..ae916cf 100644
--- a/libavfilter/formats.c
+++ b/libavfilter/formats.c
@@ -94,7 +94,7 @@ int avfilter_add_format(AVFilterFormats **avff, int fmt)
         return AVERROR(ENOMEM);
 
     fmts = av_realloc((*avff)->formats,
-                      sizeof((*avff)->formats) * ((*avff)->format_count+1));
+                      sizeof(*(*avff)->formats) * ((*avff)->format_count+1));
     if (!fmts)
         return AVERROR(ENOMEM);
 



More information about the ffmpeg-cvslog mailing list