]> granicus.if.org Git - handbrake/commitdiff
a few fixes for audio track name handling
authorJohn Stebbins <jstebbins.hb@gmail.com>
Fri, 2 Aug 2019 18:21:42 +0000 (11:21 -0700)
committerJohn Stebbins <jstebbins.hb@gmail.com>
Sun, 11 Aug 2019 22:36:40 +0000 (15:36 -0700)
fixes a memory leak makes name const

libhb/common.c
libhb/common.h
libhb/hb_json.c
libhb/muxavformat.c

index 1602b4ed072734062acba53a13349f4c37e7e89b..e21590fa243d3b3f3a3fa36c2b4708a9df172ad6 100644 (file)
@@ -4685,8 +4685,8 @@ void hb_audio_close( hb_audio_t **audio )
 {
     if ( audio && *audio )
     {
-        free((*audio)->config.in.name);
-        free((*audio)->config.out.name);
+        free((char*)(*audio)->config.in.name);
+        free((char*)(*audio)->config.out.name);
         free(*audio);
         *audio = NULL;
     }
index 098ed78cf75cc2dee37f12c60e8de2fedad04ce2..e7c9b2b5f0c854a2e223653c176426c95b2311d5 100644 (file)
@@ -831,7 +831,7 @@ struct hb_audio_config_s
         double   gain; /* Gain (in dB), negative is quieter */
         int      normalize_mix_level; /* mix level normalization (boolean) */
         int      dither_method; /* dither algorithm */
-        char *   name; /* Output track name */
+        const char * name; /* Output track name */
     } out;
 
     /* Input */
@@ -857,7 +857,7 @@ struct hb_audio_config_s
                                     * These samples should be dropped
                                     * when decoding */
         PRIVATE hb_rational_t timebase;
-        PRIVATE char * name;
+        PRIVATE const char * name;
     } in;
 
     struct
index f69a1e32233d1a3d7562cf2febcb7b04e75f40bb..08e9400a0ce135b42c923fafb99950f0eb762db8 100644 (file)
@@ -1538,10 +1538,7 @@ hb_job_t* hb_dict_to_job( hb_handle_t * h, hb_dict_t *dict )
                     audio.out.dither_method = hb_value_get_int(dither);
                 }
             }
-            if (name != NULL && name[0] != 0)
-            {
-                audio.out.name = strdup(name);
-            }
+            audio.out.name = name;
             if (audio.in.track >= 0)
             {
                 audio.out.track = ii;
index 8ae7482ac9db20d9af3708fd8f0db409cbc1ff54..e353b0e322eadb23fd5cb8f6a3727ca65d4ac28d 100644 (file)
@@ -673,7 +673,7 @@ static int avformatInit( hb_mux_object_t * m )
             track->st->codecpar->channel_layout = hb_ff_mixdown_xlat(audio->config.out.mixdown, NULL);
         }
 
-        char *name;
+        const char *name;
         if (audio->config.out.name == NULL)
         {
             switch (track->st->codecpar->channels)