cli: free ports only if not NULL

Signed-off-by: Lukas Voegl <lvoegl@tdt.de>
This commit is contained in:
Lukas Voegl
2025-08-01 11:18:54 +02:00
parent 3b8332a5a8
commit e8a5ba04d0
+2 -1
View File
@@ -346,7 +346,8 @@ print_modem_info (void)
g_free (bands); g_free (bands);
mm_modem_get_ports (ctx->modem, &ports, &n_ports); mm_modem_get_ports (ctx->modem, &ports, &n_ports);
ports_string = mm_common_build_ports_string (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); 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); ignored_ports_string = mm_common_build_ports_string (ignored_ports, n_ignored_ports);
if (ignored_ports) if (ignored_ports)