diff options
author | John Stebbins <[email protected]> | 2019-08-02 11:21:42 -0700 |
---|---|---|
committer | John Stebbins <[email protected]> | 2019-08-11 15:36:40 -0700 |
commit | 692ac873ccf2ea3a5091566ed9e2d027d4825eda (patch) | |
tree | 7e37a15bcab54a5450b22eaa6ba06af7bfeddcc5 /libhb | |
parent | f7e706149e66d826e137cbf5d2c76501bdee73c5 (diff) |
a few fixes for audio track name handling
fixes a memory leak makes name const
Diffstat (limited to 'libhb')
-rw-r--r-- | libhb/common.c | 4 | ||||
-rw-r--r-- | libhb/common.h | 4 | ||||
-rw-r--r-- | libhb/hb_json.c | 5 | ||||
-rw-r--r-- | libhb/muxavformat.c | 2 |
4 files changed, 6 insertions, 9 deletions
diff --git a/libhb/common.c b/libhb/common.c index 1602b4ed0..e21590fa2 100644 --- a/libhb/common.c +++ b/libhb/common.c @@ -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; } diff --git a/libhb/common.h b/libhb/common.h index 098ed78cf..e7c9b2b5f 100644 --- a/libhb/common.h +++ b/libhb/common.h @@ -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 diff --git a/libhb/hb_json.c b/libhb/hb_json.c index f69a1e322..08e9400a0 100644 --- a/libhb/hb_json.c +++ b/libhb/hb_json.c @@ -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; diff --git a/libhb/muxavformat.c b/libhb/muxavformat.c index 8ae7482ac..e353b0e32 100644 --- a/libhb/muxavformat.c +++ b/libhb/muxavformat.c @@ -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) |