[FFmpeg-cvslog] lavf: Remove a now useless parameter to ffurl_register_protocol

Martin Storsjö git at videolan.org
Wed Oct 30 17:56:58 CET 2013


ffmpeg | branch: master | Martin Storsjö <martin at martin.st> | Tue Oct 29 22:52:09 2013 +0200| [0c5f839693da2276c2da23400f67a67be4ea0af1] | committer: Martin Storsjö

lavf: Remove a now useless parameter to ffurl_register_protocol

This was added in 9b07a2dc02e9 as an ABI hack to allow older
code built with lavf 52 to register protocols even if the size
of the URLProtocol struct was increased. Later, registering
protocols from outside of lavf was removed and this workaround
isn't needed any longer since lavf 53.

This removes an unchecked malloc and a memory leak for the cases
when this workaround actually was used - which it hasn't since
lavf 53.

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

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

 libavformat/allformats.c |    3 +--
 libavformat/avio.c       |    7 +------
 libavformat/url.h        |    4 +---
 3 files changed, 3 insertions(+), 11 deletions(-)

diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index d72a127..fe5f582 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -45,8 +45,7 @@
     {                                                                   \
         extern URLProtocol ff_##x##_protocol;                           \
         if (CONFIG_##X##_PROTOCOL)                                      \
-            ffurl_register_protocol(&ff_##x##_protocol,                 \
-                                    sizeof(ff_##x##_protocol));         \
+            ffurl_register_protocol(&ff_##x##_protocol);                \
     }
 
 void av_register_all(void)
diff --git a/libavformat/avio.c b/libavformat/avio.c
index e07b236..fe42974 100644
--- a/libavformat/avio.c
+++ b/libavformat/avio.c
@@ -94,14 +94,9 @@ const char *avio_enum_protocols(void **opaque, int output)
     return avio_enum_protocols(opaque, output);
 }
 
-int ffurl_register_protocol(URLProtocol *protocol, int size)
+int ffurl_register_protocol(URLProtocol *protocol)
 {
     URLProtocol **p;
-    if (size < sizeof(URLProtocol)) {
-        URLProtocol *temp = av_mallocz(sizeof(URLProtocol));
-        memcpy(temp, protocol, size);
-        protocol = temp;
-    }
     p = &first_protocol;
     while (*p != NULL)
         p = &(*p)->next;
diff --git a/libavformat/url.h b/libavformat/url.h
index c27d079..ff1e21b 100644
--- a/libavformat/url.h
+++ b/libavformat/url.h
@@ -224,10 +224,8 @@ int ffurl_shutdown(URLContext *h, int flags);
 
 /**
  * Register the URLProtocol protocol.
- *
- * @param size the size of the URLProtocol struct referenced
  */
-int ffurl_register_protocol(URLProtocol *protocol, int size);
+int ffurl_register_protocol(URLProtocol *protocol);
 
 /**
  * Check if the user has requested to interrup a blocking function



More information about the ffmpeg-cvslog mailing list