Check for nil buffers in patty_ax25_sock_destroy()

Check before trying to free() nil buffers in patty_ax25_sock_destroy()
This commit is contained in:
XANTRONIX Development 2020-08-14 17:38:16 -04:00 committed by XANTRONIX Industrial
parent a5fe9be054
commit 4befed8d45

View file

@ -198,9 +198,18 @@ void patty_ax25_sock_destroy(patty_ax25_sock *sock) {
(void)close(sock->fd);
}
if (sock->tx_slots) {
free(sock->tx_slots);
}
if (sock->rx_buf) {
free(sock->rx_buf);
}
if (sock->tx_buf) {
free(sock->tx_buf);
}
free(sock);
}