Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
another round of coverity fixes (mostly NULL checks)
  • Loading branch information
perexg committed Oct 3, 2014
1 parent 36166ca commit 4939648
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
9 changes: 7 additions & 2 deletions src/config.c
Expand Up @@ -713,7 +713,8 @@ config_modify_tag( htsmsg_t *c, uint32_t id, const char *uuid, const void *aux )
htsmsg_add_msg(e, "tags_new", t);
t = htsmsg_get_list(e, "tags_new");
}
htsmsg_add_str(t, NULL, uuid);
if (t)
htsmsg_add_str(t, NULL, uuid);
}
}
}
Expand Down Expand Up @@ -791,7 +792,9 @@ config_modify_dvr_log( htsmsg_t *c, uint32_t id, const char *uuid, const void *a
HTSMSG_FOREACH(f, list) {
if (!(e = htsmsg_field_get_map(f))) continue;
if (strcmp(s1, htsmsg_get_str(e, "id") ?: "") == 0) {
htsmsg_add_str(c, "autorec", htsmsg_get_str(e, "uuid"));
const char *s2 = htsmsg_get_str(e, "uuid");
if (s2)
htsmsg_add_str(c, "autorec", s2);
break;
}
}
Expand Down Expand Up @@ -877,6 +880,8 @@ config_find_uuid( htsmsg_t *map, const char *name, const char *value )
htsmsg_field_t *f;
const char *s;

if (!map || !name || !value)
return NULL;
HTSMSG_FOREACH(f, map) {
if (!(e = htsmsg_field_get_map(f))) continue;
if ((s = htsmsg_get_str(e, name)) != NULL) {
Expand Down
3 changes: 1 addition & 2 deletions src/dvr/dvr_db.c
Expand Up @@ -1447,8 +1447,7 @@ dvr_entry_class_disp_title_set(void *o, const void *v)
if (strcmp(s, v)) {
lang_str_destroy(de->de_title);
de->de_title = lang_str_create();
if (v)
lang_str_add(de->de_title, v, NULL, 0);
lang_str_add(de->de_title, v, NULL, 0);
return 1;
}
return 0;
Expand Down
5 changes: 4 additions & 1 deletion src/misc/dbl.c
Expand Up @@ -228,9 +228,12 @@ my_double2str(char *buf, size_t bufsize, double realvalue)
precision = precision - exp;
xtype = xFLOAT;
}
}else{
}
#if 0 /* coverity - dead code - xtype == xGENERIC here */
else{
flag_rtz = 0;
}
#endif
if( xtype==xEXP ){
e2 = 0;
}else{
Expand Down
6 changes: 3 additions & 3 deletions src/muxer/tvh/mkmux.c
Expand Up @@ -656,14 +656,14 @@ _mk_build_metadata(const dvr_entry_t *de, const epg_broadcast_t *ebc)
struct tm tm;
localtime_r(de ? &de->de_start : &ebc->start, &tm);
epg_episode_t *ee = NULL;
channel_t *ch;
channel_t *ch = NULL;
lang_str_t *ls = NULL;

if (ebc) ee = ebc->episode;
else if (de && de->de_bcast) ee = de->de_bcast->episode;

if (de) ch = de->de_channel;
else ch = ebc->channel;
if (de) ch = de->de_channel;
else if (ebc) ch = ebc->channel;

snprintf(datestr, sizeof(datestr),
"%04d-%02d-%02d %02d:%02d:%02d",
Expand Down

0 comments on commit 4939648

Please sign in to comment.