]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
profile: pro_name might be NULL under some circumstances, fixes #3397
authorJaroslav Kysela <perex@perex.cz>
Tue, 8 Dec 2015 13:10:43 +0000 (14:10 +0100)
committerJaroslav Kysela <perex@perex.cz>
Tue, 8 Dec 2015 13:15:02 +0000 (14:15 +0100)
src/access.c
src/dvr/dvr_rec.c
src/htsp_server.c
src/profile.c
src/subscriptions.c

index d0eb810b5be63f2fbfcff531c49801d281dd12db..ade3f5a2028ef23403e5a1268e9b9a52dda4779d 100644 (file)
@@ -434,7 +434,7 @@ access_dump_a(access_t *a)
         if (first)
           tvh_strlcatf(buf, sizeof(buf), l, ", profile=");
         tvh_strlcatf(buf, sizeof(buf), l, "%s'%s'",
-                 first ? "" : ",", pro->pro_name ?: "");
+                 first ? "" : ",", profile_get_name(pro));
         first = 0;
       }
     }
index c32df4364b37d888232801f82fecd69823c7c09a..f8e6aaea53a2537995ca3081868171674138faae 100644 (file)
@@ -115,12 +115,12 @@ dvr_rec_subscribe(dvr_entry_t *de)
   if (profile_chain_open(prch, &de->de_config->dvr_muxcnf, 0, 0)) {
     profile_chain_close(prch);
     tvherror("dvr", "unable to create new channel streaming chain '%s' for '%s', using default",
-             pro->pro_name, channel_get_name(de->de_channel));
+             profile_get_name(pro), channel_get_name(de->de_channel));
     pro = profile_find_by_name(NULL, NULL);
     profile_chain_init(prch, pro, de->de_channel);
     if (profile_chain_open(prch, &de->de_config->dvr_muxcnf, 0, 0)) {
       tvherror("dvr", "unable to create channel streaming default chain '%s' for '%s'",
-               pro->pro_name, channel_get_name(de->de_channel));
+               profile_get_name(pro), channel_get_name(de->de_channel));
       profile_chain_close(prch);
       free(prch);
       return -EINVAL;
@@ -132,7 +132,7 @@ dvr_rec_subscribe(dvr_entry_t *de)
                                              NULL, NULL, NULL, NULL);
   if (de->de_s == NULL) {
     tvherror("dvr", "unable to create new channel subcription for '%s' profile '%s'",
-             channel_get_name(de->de_channel), pro->pro_name);
+             channel_get_name(de->de_channel), profile_get_name(pro));
     profile_chain_close(prch);
     free(prch);
     return -EINVAL;
index 2876d9d7ff4817a4d64f68d073b24c2d9f3d86cf..ce79c733dd995ab1545c791f4b64b33c5891e958 100644 (file)
@@ -2330,7 +2330,7 @@ htsp_method_subscribe(htsp_connection_t *htsp, htsmsg_t *in)
                              "htsp", SUBSCRIPTION_PACKET | SUBSCRIPTION_HTSP);
   profile_chain_init(&hs->hs_prch, pro, ch);
   if (profile_chain_work(&hs->hs_prch, &hs->hs_input, timeshiftPeriod, 0)) {
-    tvhlog(LOG_ERR, "htsp", "unable to create profile chain '%s'", pro->pro_name);
+    tvhlog(LOG_ERR, "htsp", "unable to create profile chain '%s'", profile_get_name(pro));
     profile_chain_close(&hs->hs_prch);
     free(hs);
     return htsp_error("Stream setup error");
@@ -2365,7 +2365,7 @@ htsp_method_subscribe(htsp_connection_t *htsp, htsmsg_t *in)
   LIST_INSERT_HEAD(&htsp->htsp_subscriptions, hs, hs_link);
 
   tvhdebug("htsp", "%s - subscribe to %s using profile %s",
-           htsp->htsp_logname, channel_get_name(ch), pro->pro_name ?: "");
+           htsp->htsp_logname, channel_get_name(ch), profile_get_name(pro));
   hs->hs_s = subscription_create_from_channel(&hs->hs_prch, NULL, weight,
                                              htsp->htsp_logname,
                                              SUBSCRIPTION_PACKET |
index 25879009965f77087563793922529f2f1956b3d6..4d3423316c3983a3d64771dc44a9d0f9be99c92f 100644 (file)
@@ -416,13 +416,13 @@ profile_find_by_name2(const char *name, const char *alt, int all)
     return profile_default;
 
   TAILQ_FOREACH(pro, &profiles, pro_link) {
-    if ((all || pro->pro_enabled) && !strcmp(pro->pro_name, name))
+    if ((all || pro->pro_enabled) && !strcmp(profile_get_name(pro), name))
       return pro;
   }
 
   if (alt) {
     TAILQ_FOREACH(pro, &profiles, pro_link) {
-      if ((all || pro->pro_enabled) && !strcmp(pro->pro_name, alt))
+      if ((all || pro->pro_enabled) && !strcmp(profile_get_name(pro), alt))
         return pro;
     }
   }
@@ -506,12 +506,12 @@ profile_validate_name(const char *name)
   lock_assert(&global_lock);
 
   TAILQ_FOREACH(pro, &profiles, pro_link) {
-    if (name && !strcmp(pro->pro_name, name))
+    if (name && !strcmp(profile_get_name(pro), name))
       return strdup(name);
   }
 
   if (profile_default)
-    return strdup(profile_default->pro_name);
+    return strdup(profile_get_name(profile_default));
 
   return NULL;
 }
@@ -1892,7 +1892,7 @@ profile_init(void)
 
   name = "pass";
   pro = profile_find_by_name2(name, NULL, 1);
-  if (pro == NULL || strcmp(pro->pro_name, name)) {
+  if (pro == NULL || strcmp(profile_get_name(pro), name)) {
     htsmsg_t *conf;
 
     conf = htsmsg_create_map();
@@ -1913,7 +1913,7 @@ profile_init(void)
 
   name = "matroska";
   pro = profile_find_by_name2(name, NULL, 1);
-  if (pro == NULL || strcmp(pro->pro_name, name)) {
+  if (pro == NULL || strcmp(profile_get_name(pro), name)) {
     htsmsg_t *conf;
 
     conf = htsmsg_create_map();
@@ -1929,7 +1929,7 @@ profile_init(void)
 
   name = "htsp";
   pro = profile_find_by_name2(name, NULL, 1);
-  if (pro == NULL || strcmp(pro->pro_name, name)) {
+  if (pro == NULL || strcmp(profile_get_name(pro), name)) {
     htsmsg_t *conf;
 
     conf = htsmsg_create_map();
@@ -1947,7 +1947,7 @@ profile_init(void)
 
   name = "webtv-vp8-vorbis-webm";
   pro = profile_find_by_name2(name, NULL, 1);
-  if (pro == NULL || strcmp(pro->pro_name, name)) {
+  if (pro == NULL || strcmp(profile_get_name(pro), name)) {
     htsmsg_t *conf;
 
     conf = htsmsg_create_map();
@@ -1967,7 +1967,7 @@ profile_init(void)
   }
   name = "webtv-h264-aac-mpegts";
   pro = profile_find_by_name2(name, NULL, 1);
-  if (pro == NULL || strcmp(pro->pro_name, name)) {
+  if (pro == NULL || strcmp(profile_get_name(pro), name)) {
     htsmsg_t *conf;
 
     conf = htsmsg_create_map();
@@ -1987,7 +1987,7 @@ profile_init(void)
   }
   name = "webtv-h264-aac-matroska";
   pro = profile_find_by_name2(name, NULL, 1);
-  if (pro == NULL || strcmp(pro->pro_name, name)) {
+  if (pro == NULL || strcmp(profile_get_name(pro), name)) {
     htsmsg_t *conf;
 
     conf = htsmsg_create_map();
index d07ef025da3305f663107649cc53d09eeffeb439..b7ca2a781b4d140d891ca56a2fae464ed803aa6e 100644 (file)
@@ -242,9 +242,8 @@ subscription_show_info(th_subscription_t *s)
     tvh_strlcatf(buf, sizeof(buf), l, ", service: \"%s\"", si.si_service);
 
   if (s->ths_prch && s->ths_prch->prch_pro)
-    tvh_strlcatf(buf, sizeof(buf), l,
-                       ", profile=\"%s\"",
-                       s->ths_prch->prch_pro->pro_name ?: "");
+    tvh_strlcatf(buf, sizeof(buf), l, ", profile=\"%s\"",
+                                      profile_get_name(s->ths_prch->prch_pro));
 
   if (s->ths_hostname)
     tvh_strlcatf(buf, sizeof(buf), l, ", hostname=\"%s\"", s->ths_hostname);
@@ -765,7 +764,7 @@ subscription_create_from_channel_or_service(profile_chain_t *prch,
   s = subscription_create(prch, weight, name, flags, subscription_input,
                           hostname, username, client);
   if (tvhtrace_enabled()) {
-    const char *pro_name = prch->prch_pro ? (prch->prch_pro->pro_name ?: "") : "<none>";
+    const char *pro_name = prch->prch_pro ? profile_get_name(prch->prch_pro) : "<none>";
     if (ch)
       tvhtrace("subscription", "%04X: creating subscription for %s weight %d using profile %s",
                shortid(s), channel_get_name(ch), weight, pro_name);