From e8a5ba04d042e4a822d5fad56465fda91704ccf4 Mon Sep 17 00:00:00 2001 From: Lukas Voegl Date: Fri, 1 Aug 2025 11:05:27 +0200 Subject: [PATCH] cli: free ports only if not `NULL` Signed-off-by: Lukas Voegl --- cli/mmcli-modem.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cli/mmcli-modem.c b/cli/mmcli-modem.c index 346f6a30..9d3d900a 100644 --- a/cli/mmcli-modem.c +++ b/cli/mmcli-modem.c @@ -346,7 +346,8 @@ print_modem_info (void) g_free (bands); mm_modem_get_ports (ctx->modem, &ports, &n_ports); ports_string = mm_common_build_ports_string (ports, n_ports); - mm_modem_port_info_array_free (ports, n_ports); + if (ports) + mm_modem_port_info_array_free (ports, n_ports); mm_modem_get_ignored_ports (ctx->modem, &ignored_ports, &n_ignored_ports); ignored_ports_string = mm_common_build_ports_string (ignored_ports, n_ignored_ports); if (ignored_ports)