silence compiler warning in gtlv_dec_enc.c

This was reported with gcc version 12.2.0:

 /git/libosmo-pfcp/src/libosmo-gtlv/gtlv_dec_enc.c: In function
 'osmo_gtlvs_decode_unordered':
 /git/libosmo-pfcp/src/libosmo-gtlv/gtlv_dec_enc.c:237:42: warning:
 'presence_flag_p' may be used uninitialized [-Wmaybe-uninitialized]
   237 |                         *presence_flag_p = true;
       |                                          ^
 /git/libosmo-pfcp/src/libosmo-gtlv/gtlv_dec_enc.c:113:23: note:
 'presence_flag_p' was declared here
   113 |                 bool *presence_flag_p;
       |                       ^~~~~~~~~~~~~~~

There is no actual code path that will use presence_flag_p
uninitialized, but it doesn't hurt to init with NULL.

Change-Id: I8f4c420f2182c607abb1ee5d1c8175eaeda904af
This commit is contained in:
Neels Hofmeyr 2023-01-02 14:05:36 +01:00
parent bf8e49a1bd
commit 9c96c3986f
1 changed files with 1 additions and 1 deletions

View File

@ -110,7 +110,7 @@ static int osmo_gtlvs_decode_unordered(void *decoded_struct, size_t decoded_stru
* any). */
for (;;) {
int rc;
bool *presence_flag_p;
bool *presence_flag_p = NULL;
unsigned int memb_next_array_idx;
unsigned int memb_ofs;
unsigned int ie_max_allowed_count;