summaryrefslogtreecommitdiffstats
path: root/libhb/common.c
diff options
context:
space:
mode:
authorDamiano Galassi <[email protected]>2018-01-12 20:54:08 +0100
committerDamiano Galassi <[email protected]>2018-01-12 20:55:14 +0100
commit696ebe518b38bb186e7f6692f91a3c799f3c838c (patch)
treeecc88a4c55f1a5c0414f57fb175149b1fe8c9d3b /libhb/common.c
parent9bd2b8e50ca2e8e0b52580714b54dbca33b809a5 (diff)
libhb: fix a number of issues reported by clang.
Diffstat (limited to 'libhb/common.c')
-rw-r--r--libhb/common.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/libhb/common.c b/libhb/common.c
index 301f121dd..80ccf9f17 100644
--- a/libhb/common.c
+++ b/libhb/common.c
@@ -874,6 +874,13 @@ int hb_audio_samplerate_find_closest(int samplerate, uint32_t codec)
const hb_rate_t * rate, * prev, * next;
rate = prev = next = hb_audio_samplerate_get_next_for_codec(NULL, codec);
+
+ if (rate == NULL)
+ {
+ // This codec doesn't support any samplerate
+ return 0;
+ }
+
while (rate != NULL && next->rate < samplerate)
{
rate = hb_audio_samplerate_get_next_for_codec(rate, codec);
@@ -4605,6 +4612,7 @@ int hb_audio_add(const hb_job_t * job, const hb_audio_config_t * audiocfg)
{
/* This most likely means the client didn't call hb_audio_config_init
* so bail. */
+ hb_audio_close(&audio);
return 0;
}
@@ -5196,7 +5204,12 @@ char * hb_strncat_dup( const char * s1, const char * s2, size_t n )
strcpy( str, s1 );
else
strcpy( str, "" );
- strncat( str, s2, n );
+
+ if (s2)
+ {
+ strncat( str, s2, n );
+ }
+
return str;
}