[vlc-commits] [Git][videolan/vlc][3.0.x] adaptive: use malloc for HTTP resources

Steve Lhomme (@robUx4) gitlab at videolan.org
Tue Nov 10 07:06:06 UTC 2026



Steve Lhomme pushed to branch 3.0.x at VideoLAN / VLC


Commits:
b72f94a6 by Alaric Senat at 2026-11-03T08:28:00+00:00
adaptive: use malloc for HTTP resources

Fix an allocator mismatch for HTTP resources. They are destroyed via a
free call in the C API via the `vlc_http_res_destroy` function.

(cherry picked from commit 9884290f8aa37635abee6375f3329b99ecc7a567)
Signed-off-by: Thomas Guillem <thomas at gllm.fr>

- - - - -


1 changed file:

- modules/demux/adaptive/http/HTTPConnection.cpp


Changes:

=====================================
modules/demux/adaptive/http/HTTPConnection.cpp
=====================================
@@ -195,14 +195,18 @@ class adaptive::http::LibVLCHTTPSource : public adaptive::AbstractSource
         int create(const char *uri,const std::string &ua,
                    const std::string &ref, const BytesRange &range)
         {
-            struct restuple *tpl = new struct restuple;
+            auto *tpl = static_cast<struct restuple *>(
+                std::malloc(sizeof(struct restuple)));
+            if (unlikely(tpl == nullptr))
+                return -1;
+
             tpl->source = this;
             this->range = range;
             if (vlc_http_res_init(&tpl->resource, &this->callbacks, http_mgr, uri,
                                   ua.empty() ? nullptr : ua.c_str(),
                                   ref.empty() ? nullptr : ref.c_str()))
             {
-                delete tpl;
+                std::free(tpl);
                 return -1;
             }
             http_res = &tpl->resource;



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/b72f94a6391c3793618e2d1cb36a134a1261dc14

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/b72f94a6391c3793618e2d1cb36a134a1261dc14
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help




More information about the vlc-commits mailing list