-
Philip Withnall authored
scan-build was complaining that `dest_hostname` and `dest_protocol` were used after being freed, which could potentially happen if the code is built with `G_DISABLE_CHECKS`. This is a false positive, because the state of types in the program should be the same regardless of whether `G_DISABLE_CHECKS` is used. However, the code did smell. If we are trying to free things and return gracefully if the underlying socket address enumerator returns something of the wrong type, why not free the rest of the function’s state, or skip the invalid address and move on to the next one? Or if we are trying to make an assertion, why bother freeing some temporary data at all? This halfway house doesn’t make sense. So turn the `g_return_val_if_fail()` into a full assertion. Signed-off-by:
Philip Withnall <pwithnall@gnome.org> Helps: #1767
Philip Withnall authoredscan-build was complaining that `dest_hostname` and `dest_protocol` were used after being freed, which could potentially happen if the code is built with `G_DISABLE_CHECKS`. This is a false positive, because the state of types in the program should be the same regardless of whether `G_DISABLE_CHECKS` is used. However, the code did smell. If we are trying to free things and return gracefully if the underlying socket address enumerator returns something of the wrong type, why not free the rest of the function’s state, or skip the invalid address and move on to the next one? Or if we are trying to make an assertion, why bother freeing some temporary data at all? This halfway house doesn’t make sense. So turn the `g_return_val_if_fail()` into a full assertion. Signed-off-by:
Philip Withnall <pwithnall@gnome.org> Helps: #1767
Loading