This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree:

Subject: lib/libdvbv5/dvb-file.c: check for valid entry pointer
Author:  Hans Verkuil <[email protected]>
Date:    Thu Aug 3 14:12:56 2023 +0200

The entry pointer could be used uninitialized, so initialize it to
NULL and add a NULL check to avoid derefencing a NULL pointer.

This fixes this compiler warning:

../lib/libdvbv5/dvb-file.c: In function 'get_program_and_store':
../lib/libdvbv5/dvb-file.c:1236:29: warning: 'entry' may be used uninitialized 
[-Wmaybe-uninitialized]
 1236 |                 entry->next = calloc(sizeof(*entry), 1);
      |                 ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
../lib/libdvbv5/dvb-file.c:1200:27: note: 'entry' was declared here
 1200 |         struct dvb_entry *entry;
      |                           ^~~~~

Signed-off-by: Hans Verkuil <[email protected]>

 lib/libdvbv5/dvb-file.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

---

http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=a0c26a97308ea1c5e809245df570e2f04e668168
diff --git a/lib/libdvbv5/dvb-file.c b/lib/libdvbv5/dvb-file.c
index 51e86d4119ac..09d071dab694 100644
--- a/lib/libdvbv5/dvb-file.c
+++ b/lib/libdvbv5/dvb-file.c
@@ -1197,7 +1197,7 @@ static int get_program_and_store(struct 
dvb_v5_fe_parms_priv *parms,
                                 char *vchannel,
                                 int get_detected, int get_nit)
 {
-       struct dvb_entry *entry;
+       struct dvb_entry *entry = NULL;
        int i, j, r, found = 0;
        uint32_t freq = 0;
 
@@ -1232,7 +1232,7 @@ static int get_program_and_store(struct 
dvb_v5_fe_parms_priv *parms,
        if (!dvb_file->first_entry) {
                dvb_file->first_entry = calloc(sizeof(*entry), 1);
                entry = dvb_file->first_entry;
-       } else {
+       } else if (entry) {
                entry->next = calloc(sizeof(*entry), 1);
                entry = entry->next;
        }

_______________________________________________
linuxtv-commits mailing list
[email protected]
https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to