]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Make a code path easier for static analyzers to understand
authorJouni Malinen <j@w1.fi>
Sat, 7 Jun 2014 12:37:31 +0000 (15:37 +0300)
committerJouni Malinen <j@w1.fi>
Sat, 7 Jun 2014 12:37:31 +0000 (15:37 +0300)
prev cannot be NULL here in the hostapd_eid_country_add() call since
prev is set whenever start becomes non-NULL. That seems to be a bit too
difficult for some static analyzers, so check the prev pointer
explicitly to avoid false warnings.

Signed-off-by: Jouni Malinen <j@w1.fi>
src/ap/beacon.c

index 2a4acf24165fd09ca58c9cf0d3a6ae1eb731fa10..73dffe2c123aeb65193a0e5167d57a33518bb16c 100644 (file)
@@ -220,7 +220,7 @@ static u8 * hostapd_eid_country(struct hostapd_data *hapd, u8 *eid,
                        continue; /* can use same entry */
                }
 
-               if (start) {
+               if (start && prev) {
                        pos = hostapd_eid_country_add(pos, end, chan_spacing,
                                                      start, prev);
                        start = NULL;