diff mbox series

[1/2] libdvbv5: Read all "other" PIDs for channels

Message ID da8f5aa8-e413-1678-d93d-6e8d20fb97b6@0882a8b5-c6c3-11e9-b005-00805fc181fe
State New
Headers show
Series [1/2] libdvbv5: Read all "other" PIDs for channels | expand

Commit Message

Simon Arlott Jan. 23, 2021, 1:51 p.m. UTC
When there are multiple PID_* entries in the channels file, keep all of
them instead of only the last one.

Signed-off-by: Simon Arlott <v4l@octiron.net>
---
 lib/libdvbv5/dvb-file.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/lib/libdvbv5/dvb-file.c b/lib/libdvbv5/dvb-file.c
index 866e4c6c..68265f4e 100644
--- a/lib/libdvbv5/dvb-file.c
+++ b/lib/libdvbv5/dvb-file.c
@@ -670,21 +670,18 @@  static int fill_entry(struct dvb_entry *entry, char *key, char *value)
 		if (!type)
 			return 0;
 
-		len = 0;
-
 		p = strtok(value," \t");
 		if (!p)
 			return 0;
 		while (p) {
 			entry->other_el_pid = realloc(entry->other_el_pid,
-						      (len + 1) *
+						      (entry->other_el_pid_len + 1) *
 						      sizeof (*entry->other_el_pid));
-			entry->other_el_pid[len].type = type;
-			entry->other_el_pid[len].pid = atol(p);
+			entry->other_el_pid[entry->other_el_pid_len].type = type;
+			entry->other_el_pid[entry->other_el_pid_len].pid = atol(p);
 			p = strtok(NULL, " \t\n");
-			len++;
+			entry->other_el_pid_len++;
 		}
-		entry->other_el_pid_len = len;
 	}
 
 	if (!is_video && !is_audio) {