3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-25 09:39:25 +01:00

client: fix two issues caught by static analysis

- va_end was not being called on an error condition
 - An uninitialized struct was being accessed if ioctl failed
This commit is contained in:
James Prestwood 2024-03-01 11:40:56 -08:00 committed by Denis Kenzior
parent 121c2c5653
commit 6bedcb4622

View File

@ -230,7 +230,8 @@ static void display_refresh_check_feasibility(void)
{
const struct winsize ws;
ioctl(STDOUT_FILENO, TIOCGWINSZ, &ws);
if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &ws) < 0)
return;
if (ws.ws_col < LINE_LEN - 1) {
if (display_refresh.enabled) {
@ -564,8 +565,6 @@ void display_table_row(const char *margin, unsigned int ncolumns, ...)
str += entry_append(e, str);
}
va_end(va);
display("%s\n", buf);
str = buf;
@ -591,6 +590,8 @@ void display_table_row(const char *margin, unsigned int ncolumns, ...)
}
done:
va_end(va);
for (i = 0; i < ncolumns; i++) {
if (entries[i].color)
l_free(entries[i].color);