mirror of https://github.com/HandBrake/HandBrake
libhb: fix various clang static analyzer warnings
This commit is contained in:
parent
54a05b9719
commit
7e7e8962a3
|
|
@ -1157,8 +1157,8 @@ static int comb_detect_init(hb_filter_object_t *filter,
|
|||
pv->gamma_spatial_threshold6 = 6 * pv->gamma_spatial_threshold;
|
||||
pv->spatial_threshold_squared = pv->spatial_threshold * pv->spatial_threshold;
|
||||
pv->spatial_threshold6 = 6 * pv->spatial_threshold;
|
||||
pv->comb32detect_min = 10 << (pv->depth - 8);
|
||||
pv->comb32detect_max = 15 << (pv->depth - 8);
|
||||
pv->comb32detect_min = pv->depth >= 8 ? 10 << (pv->depth - 8) : 10;
|
||||
pv->comb32detect_max = pv->depth >= 8 ? 15 << (pv->depth - 8) : 15;
|
||||
|
||||
pv->cpu_count = hb_get_cpu_count();
|
||||
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ hb_decavsub_context_t * decavsubInit( hb_work_object_t * w, hb_job_t * job )
|
|||
if (ctx->pkt == NULL)
|
||||
{
|
||||
hb_log("decavsubInit: av_packet_alloc failed");
|
||||
return NULL;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
// avcodec may create or change subtitle header
|
||||
|
|
|
|||
|
|
@ -899,11 +899,12 @@ int encavcodecInit( hb_work_object_t * w, hb_job_t * job )
|
|||
}
|
||||
else
|
||||
{
|
||||
int size;
|
||||
long size;
|
||||
char * log;
|
||||
|
||||
pv->file = hb_fopen(filename, "rb");
|
||||
if (!pv->file) {
|
||||
if (!pv->file)
|
||||
{
|
||||
if (strerror_r(errno, reason, 79) != 0)
|
||||
strcpy(reason, "unknown -- strerror_r() failed");
|
||||
|
||||
|
|
@ -915,6 +916,17 @@ int encavcodecInit( hb_work_object_t * w, hb_job_t * job )
|
|||
fseek( pv->file, 0, SEEK_END );
|
||||
size = ftell( pv->file );
|
||||
fseek( pv->file, 0, SEEK_SET );
|
||||
|
||||
if (size == -1)
|
||||
{
|
||||
hb_error( "encavcodecInit: Failed to read %s", filename);
|
||||
free(filename);
|
||||
ret = 1;
|
||||
fclose( pv->file );
|
||||
pv->file = NULL;
|
||||
goto done;
|
||||
}
|
||||
|
||||
log = malloc( size + 1 );
|
||||
log[size] = '\0';
|
||||
if (size > 0 &&
|
||||
|
|
|
|||
|
|
@ -2337,13 +2337,17 @@ static void redirect_thread_func(void * _data)
|
|||
#endif
|
||||
setvbuf(stderr, NULL, _IONBF, 0);
|
||||
|
||||
FILE * log_f = fdopen(pfd[0], "rb");
|
||||
FILE *log_f = fdopen(pfd[0], "rb");
|
||||
|
||||
if (log_f != NULL)
|
||||
{
|
||||
char line_buffer[500];
|
||||
while(fgets(line_buffer, 500, log_f) != NULL)
|
||||
{
|
||||
hb_log_callback(line_buffer);
|
||||
}
|
||||
fclose(log_f);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -277,6 +277,12 @@ static int avformatInit( hb_mux_object_t * m )
|
|||
hb_list_count( job->list_subtitle );
|
||||
m->tracks = calloc(max_tracks, sizeof(hb_mux_data_t*));
|
||||
|
||||
if (m->tracks == NULL)
|
||||
{
|
||||
hb_error("muxavformat: calloc failed");
|
||||
goto error;
|
||||
}
|
||||
|
||||
AVDictionary * av_opts = NULL;
|
||||
switch (job->mux)
|
||||
{
|
||||
|
|
@ -1207,13 +1213,16 @@ static int avformatInit( hb_mux_object_t * m )
|
|||
return 0;
|
||||
|
||||
error:
|
||||
if (m->tracks)
|
||||
{
|
||||
for (ii = 0; ii < m->ntracks; ii++)
|
||||
{
|
||||
if (m->tracks[ii]->oc != NULL)
|
||||
if (m->tracks[ii] != NULL && m->tracks[ii]->oc != NULL)
|
||||
{
|
||||
avformat_free_context(m->tracks[ii]->oc);
|
||||
}
|
||||
}
|
||||
}
|
||||
av_dict_free(&av_opts);
|
||||
free(job->mux_data);
|
||||
job->mux_data = NULL;
|
||||
|
|
|
|||
|
|
@ -400,8 +400,10 @@ static OSType hb_vt_encoder_pixel_format_xlat(int vcodec, int profile, int color
|
|||
{
|
||||
case HB_VT_H265_PROFILE_MAIN_10:
|
||||
pix_fmt = hb_vt_get_best_pix_fmt(vcodec, "main-10");
|
||||
break;
|
||||
case HB_VT_H265_PROFILE_MAIN_422_10:
|
||||
pix_fmt = hb_vt_get_best_pix_fmt(vcodec, "main422-10");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -356,7 +356,7 @@ static char ** get_fields(char * line, int last)
|
|||
{
|
||||
result[ii] = get_field(&pos);
|
||||
}
|
||||
result[ii] = strdup(pos);
|
||||
result[ii] = pos != NULL ? strdup(pos) : NULL;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue