[vlc-commits] [Git][videolan/vlc][master] codec: rav1e: allocate timebase on stack

Steve Lhomme (@robUx4) gitlab at videolan.org
Wed Jan 18 12:16:12 UTC 2023



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
145c250b by Tristan Matthews at 2023-01-18T11:43:00+00:00
codec: rav1e: allocate timebase on stack

This is getting leaked and doesn't need to be dynamically allocated.

- - - - -


1 changed file:

- modules/codec/rav1e.c


Changes:

=====================================
modules/codec/rav1e.c
=====================================
@@ -178,17 +178,9 @@ static int OpenEncoder(vlc_object_t *this)
         goto error;
     }
 
-    RaRational *timebase = malloc(sizeof(RaRational));
-    if (timebase == NULL)
-    {
-        msg_Err(enc, "%s", "Unable to allocate timebase\n");
-        err = VLC_ENOMEM;
-        goto error;
-    }
+    RaRational timebase = { .num = enc->fmt_in.video.i_frame_rate_base, .den = enc->fmt_in.video.i_frame_rate };
 
-    timebase->num = enc->fmt_in.video.i_frame_rate_base;
-    timebase->den = enc->fmt_in.video.i_frame_rate;
-    rav1e_config_set_time_base(ra_config, *timebase);
+    rav1e_config_set_time_base(ra_config, timebase);
 
     int tile_rows = var_InheritInteger(enc, SOUT_CFG_PREFIX "tile-rows");
     int tile_columns = var_InheritInteger(enc, SOUT_CFG_PREFIX "tile-columns");



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

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/145c250bb3440800c783940fce09514348b9e07f
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