coverity fixes....

This commit is contained in:
Jaroslav Kysela 2014-11-10 14:25:14 +01:00
parent 1efe779dbb
commit 4e63e0d74a
8 changed files with 37 additions and 33 deletions

View file

@ -571,6 +571,10 @@ access_get_hashed(const char *username, const uint8_t digest[20],
continue; /* IP based access mismatches */
if(ae->ae_username[0] != '*') {
if (!username)
continue;
SHA1_Init(&shactx);
SHA1_Update(&shactx, (const uint8_t *)ae->ae_password,
strlen(ae->ae_password));

View file

@ -219,7 +219,7 @@ static int
api_idnode_load
( access_t *perm, void *opaque, const char *op, htsmsg_t *args, htsmsg_t **resp )
{
int err = 0, meta = 0, count = 0;
int err = 0, meta, count = 0;
idnode_t *in;
htsmsg_t *uuids, *l = NULL, *m;
htsmsg_t *flist;
@ -244,7 +244,7 @@ api_idnode_load
if (!(uuids = htsmsg_field_get_list(f)))
if (!(uuid = htsmsg_field_get_str(f)))
return EINVAL;
htsmsg_get_s32(args, "meta", &meta);
meta = htsmsg_get_s32_or_default(args, "meta", 0);
flist = api_idnode_flist_conf(args, "list");

View file

@ -276,11 +276,6 @@ static int _epg_write ( int fd, htsmsg_t *m )
} else {
ret = 0;
}
if(ret) {
tvhlog(LOG_ERR, "epgdb", "failed to store epg to disk");
close(fd);
hts_settings_remove("epgdb.v%d", EPG_DB_VERSION);
}
return ret;
}
@ -313,35 +308,36 @@ void epg_save ( void )
return;
memset(&stats, 0, sizeof(stats));
if ( _epg_write_sect(fd, "config") ) goto fin;
if (_epg_write(fd, epg_config_serialize())) goto fin;
if ( _epg_write_sect(fd, "brands") ) goto fin;
if ( _epg_write_sect(fd, "config") ) goto error;
if (_epg_write(fd, epg_config_serialize())) goto error;
if ( _epg_write_sect(fd, "brands") ) goto error;
RB_FOREACH(eo, &epg_brands, uri_link) {
if (_epg_write(fd, epg_brand_serialize((epg_brand_t*)eo))) goto fin;
if (_epg_write(fd, epg_brand_serialize((epg_brand_t*)eo))) goto error;
stats.brands.total++;
}
if ( _epg_write_sect(fd, "seasons") ) goto fin;
if ( _epg_write_sect(fd, "seasons") ) goto error;
RB_FOREACH(eo, &epg_seasons, uri_link) {
if (_epg_write(fd, epg_season_serialize((epg_season_t*)eo))) goto fin;
if (_epg_write(fd, epg_season_serialize((epg_season_t*)eo))) goto error;
stats.seasons.total++;
}
if ( _epg_write_sect(fd, "episodes") ) goto fin;
if ( _epg_write_sect(fd, "episodes") ) goto error;
RB_FOREACH(eo, &epg_episodes, uri_link) {
if (_epg_write(fd, epg_episode_serialize((epg_episode_t*)eo))) goto fin;
if (_epg_write(fd, epg_episode_serialize((epg_episode_t*)eo))) goto error;
stats.episodes.total++;
}
if ( _epg_write_sect(fd, "serieslinks") ) goto fin;
if ( _epg_write_sect(fd, "serieslinks") ) goto error;
RB_FOREACH(eo, &epg_serieslinks, uri_link) {
if (_epg_write(fd, epg_serieslink_serialize((epg_serieslink_t*)eo))) goto fin;
if (_epg_write(fd, epg_serieslink_serialize((epg_serieslink_t*)eo))) goto error;
stats.seasons.total++;
}
if ( _epg_write_sect(fd, "broadcasts") ) goto fin;
if ( _epg_write_sect(fd, "broadcasts") ) goto error;
CHANNEL_FOREACH(ch) {
RB_FOREACH(ebc, &ch->ch_epg_schedule, sched_link) {
if (_epg_write(fd, epg_broadcast_serialize(ebc))) goto fin;
if (_epg_write(fd, epg_broadcast_serialize(ebc))) goto error;
stats.broadcasts.total++;
}
}
close(fd);
/* Stats */
tvhlog(LOG_INFO, "epgdb", "saved");
@ -350,6 +346,10 @@ void epg_save ( void )
tvhlog(LOG_INFO, "epgdb", " episodes %d", stats.episodes.total);
tvhlog(LOG_INFO, "epgdb", " broadcasts %d", stats.broadcasts.total);
fin:
return;
error:
tvhlog(LOG_ERR, "epgdb", "failed to store epg to disk");
hts_settings_remove("epgdb.v%d", EPG_DB_VERSION);
close(fd);
}

View file

@ -712,6 +712,8 @@ dvb_bskyb_local_channels
if (len < 2)
return;
assert(bi);
regionid = (ptr[1] != 0xff) ? ptr[1] : 0xffff;
#if 0
@ -758,7 +760,7 @@ dvb_bskyb_local_channels
break;
if (mm && !bs) {
s = mpegts_service_find(mm, sid, 0, 0, NULL);
if (bi && s) {
if (s) {
bs = calloc(1, sizeof(*bs));
bs->svc = s;
TAILQ_INSERT_TAIL(&bi->services, bs, link);

View file

@ -497,8 +497,10 @@ lav_muxer_destroy(muxer_t *m)
if(lm->lm_h264_filter)
av_bitstream_filter_close(lm->lm_h264_filter);
for(i=0; i<lm->lm_oc->nb_streams; i++)
av_freep(&lm->lm_oc->streams[i]->codec->extradata);
if (lm->lm_oc) {
for(i=0; i<lm->lm_oc->nb_streams; i++)
av_freep(&lm->lm_oc->streams[i]->codec->extradata);
}
if(lm->lm_oc && lm->lm_oc->pb) {
av_freep(&lm->lm_oc->pb->buffer);

View file

@ -919,10 +919,10 @@ transcoder_stream_video(transcoder_t *t, transcoder_stream_t *ts, th_pkt_t *pkt)
AVCodec *icodec, *ocodec;
AVCodecContext *ictx, *octx;
AVDictionary *opts;
AVPacket packet;
AVPacket packet, packet2;
AVPicture deint_pic;
uint8_t *buf, *out, *deint;
int length, len, got_picture;
uint8_t *buf, *deint;
int length, len, ret, got_picture, got_output;
video_stream_t *vs = (video_stream_t*)ts;
ictx = vs->vid_ictx;
@ -931,7 +931,7 @@ transcoder_stream_video(transcoder_t *t, transcoder_stream_t *ts, th_pkt_t *pkt)
icodec = vs->vid_icodec;
ocodec = vs->vid_ocodec;
buf = out = deint = NULL;
buf = deint = NULL;
opts = NULL;
if (ictx->codec_id == AV_CODEC_ID_NONE) {
@ -1136,8 +1136,6 @@ transcoder_stream_video(transcoder_t *t, transcoder_stream_t *ts, th_pkt_t *pkt)
else if (ictx->coded_frame && ictx->coded_frame->pts != AV_NOPTS_VALUE)
vs->vid_enc_frame->pts = vs->vid_dec_frame->pts;
AVPacket packet2;
int ret, got_output;
av_init_packet(&packet2);
packet2.data = NULL; // packet data will be allocated by the encoder
@ -1162,9 +1160,6 @@ transcoder_stream_video(transcoder_t *t, transcoder_stream_t *ts, th_pkt_t *pkt)
if(buf)
av_free(buf);
if(out)
av_free(out);
if(deint)
av_free(deint);

View file

@ -1502,6 +1502,7 @@ service_instance_add(service_instance_list_t *sil,
si->si_weight = weight;
si->si_prio = prio;
strncpy(si->si_source, source ?: "<unknown>", sizeof(si->si_source));
si->si_source[sizeof(si->si_source)-1] = '\0';
TAILQ_INSERT_SORTED(sil, si, si_link, si_cmp);
return si;
}

View file

@ -602,7 +602,7 @@ subscription_create
streaming_target_init(&s->ths_input, cb, s, reject);
s->ths_prch = prch->prch_st ? prch : NULL;
s->ths_prch = prch && prch->prch_st ? prch : NULL;
s->ths_weight = weight;
s->ths_title = strdup(name);
s->ths_hostname = hostname ? strdup(hostname) : NULL;