[PATCH v2 2/2] cert: Fix uninitialised variable

Bastien Nocera <[email protected]>
Newsgroups dev.linux.lists.ell
Message-ID <[email protected]>
In file included from ./ell/util.h:20,
                 from ell/private.h:8,
                 from ell/cert.c:18:
In function '_l_l_free_cleanup',
    inlined from 'cert_set_filter_by_validity' at ell/cert.c:618:33,
    inlined from 'l_certchain_verify' at ell/cert.c:729:20:
./ell/util.h:257:21: warning: 'valid' may be used uninitialized [-Wmaybe-uninitialized]
  257 | DEFINE_CLEANUP_FUNC(l_free);
ell/cert.c: In function 'l_certchain_verify':
ell/cert.c:618:40: note: 'valid' was declared here
  618 |         _auto_(l_free) struct l_cert **valid;
      |                                        ^~~~~
---
Changes since v1:
- None

 ell/cert.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ell/cert.c b/ell/cert.c
index ac9bdb7ee9e2..ad0d91c5f073 100644
--- a/ell/cert.c
+++ b/ell/cert.c
@@ -615,7 +615,7 @@ static struct l_cert **cert_set_filter_by_validity(struct l_queue *set,
 							int *out_valid)
 {
 	const struct l_queue_entry *entry;
-	_auto_(l_free) struct l_cert **valid;
+	_auto_(l_free) struct l_cert **valid = NULL;
 
 	*out_total = l_queue_length(set);
 	*out_valid = 0;
-- 
2.55.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.