diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c index 16031c923..36558c908 100644 --- a/wpa_supplicant/config.c +++ b/wpa_supplicant/config.c @@ -467,6 +467,11 @@ static char * wpa_config_write_proto(const struct parse_data *data, pos += ret; } + if (pos == buf) { + os_free(buf); + buf = NULL; + } + return buf; } #endif /* NO_CONFIG_WRITE */ @@ -672,6 +677,11 @@ static char * wpa_config_write_key_mgmt(const struct parse_data *data, } #endif /* CONFIG_WPS */ + if (pos == buf) { + os_free(buf); + buf = NULL; + } + return buf; } #endif /* NO_CONFIG_WRITE */ @@ -863,6 +873,11 @@ static char * wpa_config_write_auth_alg(const struct parse_data *data, pos += ret; } + if (pos == buf) { + os_free(buf); + buf = NULL; + } + return buf; } #endif /* NO_CONFIG_WRITE */