[vlc-commits] [Git][videolan/vlc][master] input: mrl_helper: fix array init/clean cycle

Steve Lhomme (@robUx4) gitlab at videolan.org
Tue Sep 12 05:29:26 UTC 2023



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
afc0ad04 by Francois Cartegnie at 2023-09-12T05:11:29+00:00
input: mrl_helper: fix array init/clean cycle

can't be delegated to callee

- - - - -


3 changed files:

- src/input/mrl_helpers.h
- src/input/stream_extractor.c
- src/test/mrl_helpers.c


Changes:

=====================================
src/input/mrl_helpers.h
=====================================
@@ -118,8 +118,6 @@ mrl_FragmentSplit( vlc_array_t* out_items,
 {
     char const* extra = NULL;
 
-    vlc_array_init( out_items );
-
     while( strncmp( payload, "!/", 2 ) == 0 )
     {
         payload += 2;


=====================================
src/input/stream_extractor.c
=====================================
@@ -346,6 +346,7 @@ stream_extractor_AttachParsed( stream_t** source, char const* data,
 {
     vlc_array_t identifiers;
 
+    vlc_array_init( &identifiers );
     if( mrl_FragmentSplit( &identifiers, out_extra, data ) )
         return VLC_EGENERIC;
 


=====================================
src/test/mrl_helpers.c
=====================================
@@ -72,6 +72,7 @@ int main (void)
     for (size_t i = 0; i < ARRAY_SIZE(testcase); ++i)
     {
         vlc_array_t out;
+        vlc_array_init(&out);
         const char *extra = NULL;
         int ret = mrl_FragmentSplit(&out, &extra, testcase[i].payload);
         if (testcase[i].success)
@@ -99,12 +100,12 @@ int main (void)
                 free(res_escaped);
                 free(res);
             }
-            vlc_array_clear(&out);
         }
         else
         {
             assert(ret != VLC_SUCCESS);
         }
+        vlc_array_clear(&out);
     }
     return 0;
 }



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

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/afc0ad0417795705d43f56ce2d0eb3440f59d0f0
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list