linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: tskd08@gmail.com
To: linux-media@vger.kernel.org
Cc: m.chehab@samsung.com
Subject: [PATCH 1/4] v4l-utils/libdvbv5: avoid crash when failed to get a channel name
Date: Wed,  8 Oct 2014 21:09:38 +0900	[thread overview]
Message-ID: <1412770181-5420-2-git-send-email-tskd08@gmail.com> (raw)
In-Reply-To: <1412770181-5420-1-git-send-email-tskd08@gmail.com>

From: Akihiro Tsukada <tskd08@gmail.com>

Signed-off-by: Akihiro Tsukada <tskd08@gmail.com>
---
 lib/libdvbv5/dvb-file.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/lib/libdvbv5/dvb-file.c b/lib/libdvbv5/dvb-file.c
index 27d9a63..bcb1762 100644
--- a/lib/libdvbv5/dvb-file.c
+++ b/lib/libdvbv5/dvb-file.c
@@ -1121,20 +1121,21 @@ static int get_program_and_store(struct dvb_v5_fe_parms_priv *parms,
 		if (rc)
 			dvb_logerr("Couldn't get frontend props");
 	}
-	if (!*channel) {
-		r = asprintf(&channel, "%.2fMHz#%d", freq/1000000., service_id);
-		if (r < 0)
-			dvb_perror("asprintf");
-		if (parms->p.verbose)
-			dvb_log("Storing as: '%s'", channel);
-	}
 	for (j = 0; j < parms->n_props; j++) {
 		entry->props[j].cmd = parms->dvb_prop[j].cmd;
 		entry->props[j].u.data = parms->dvb_prop[j].u.data;
 
-		if (!*channel && entry->props[j].cmd == DTV_FREQUENCY)
+		if ((!channel || !*channel) &&
+		    entry->props[j].cmd == DTV_FREQUENCY)
 			freq = parms->dvb_prop[j].u.data;
 	}
+	if (!channel || !*channel) {
+		r = asprintf(&channel, "%.2fMHz#%d", freq/1000000., service_id);
+		if (r < 0)
+			dvb_perror("asprintf");
+		if (parms->p.verbose)
+			dvb_log("Storing as: '%s'", channel);
+	}
 	entry->n_props = parms->n_props;
 	entry->channel = channel;
 
-- 
2.1.2


  reply	other threads:[~2014-10-08 12:10 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-08 12:09 [PATCH 0/4] v4l-utils:libdvbv5,dvb: add basic support for ISDB-S tskd08
2014-10-08 12:09 ` tskd08 [this message]
2014-10-08 16:05   ` [PATCH 1/4] v4l-utils/libdvbv5: avoid crash when failed to get a channel name Mauro Carvalho Chehab
2014-10-08 12:09 ` [PATCH 2/4] v4l-utils/libdvbv5: add support for ISDB-S tuning tskd08
2014-10-08 13:57   ` Mauro Carvalho Chehab
2014-10-08 12:09 ` [PATCH 3/4] v4l-utils/libdvbv5: add support for ISDB-S scanning tskd08
2014-10-08 15:59   ` Mauro Carvalho Chehab
2014-10-08 12:09 ` [PATCH 4/4] v4l-utils/dvbv5-scan: " tskd08
2014-10-08 16:04   ` Mauro Carvalho Chehab
2014-10-09 18:11     ` Akihiro TSUKADA
2014-10-09 18:35       ` Mauro Carvalho Chehab
2014-10-08 16:22 ` [PATCH 0/4] v4l-utils:libdvbv5,dvb: add basic support for ISDB-S Mauro Carvalho Chehab
2014-10-09 16:41   ` Akihiro TSUKADA

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1412770181-5420-2-git-send-email-tskd08@gmail.com \
    --to=tskd08@gmail.com \
    --cc=linux-media@vger.kernel.org \
    --cc=m.chehab@samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).