[FFmpeg-cvslog] mem: Make av_strdup allocate using av_realloc

Martin Storsjö git at videolan.org
Thu Oct 17 08:43:02 CEST 2013


ffmpeg | branch: master | Martin Storsjö <martin at martin.st> | Sat Oct  5 00:19:13 2013 +0300| [d433e1aefabd7934d9ba9ae552525faacf4e47c5] | committer: Martin Storsjö

mem: Make av_strdup allocate using av_realloc

This makes sure that pointers from av_strdup are reallocable,
which is used in av_dict_set if the AV_DICT_APPEND flag is set.

Nothing should rely on pointers from av_strdup being aligned.

Signed-off-by: Martin Storsjö <martin at martin.st>

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

 libavutil/mem.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavutil/mem.c b/libavutil/mem.c
index b84020c..15a8c07 100644
--- a/libavutil/mem.c
+++ b/libavutil/mem.c
@@ -214,7 +214,7 @@ char *av_strdup(const char *s)
     char *ptr = NULL;
     if (s) {
         int len = strlen(s) + 1;
-        ptr = av_malloc(len);
+        ptr = av_realloc(NULL, len);
         if (ptr)
             memcpy(ptr, s, len);
     }



More information about the ffmpeg-cvslog mailing list