Index: libjack/client.c =================================================================== --- libjack/client.c (Revision 4066) +++ libjack/client.c (Arbeitskopie) @@ -2796,11 +2796,6 @@ matching_ports[match_cnt] = 0; - if (match_cnt == 0) { - free (matching_ports); - matching_ports = 0; - } - return matching_ports; } Index: tools/lsp.c =================================================================== --- tools/lsp.c (Revision 4066) +++ tools/lsp.c (Arbeitskopie) @@ -135,7 +135,10 @@ return 1; } - ports = jack_get_ports (client, NULL, NULL, 0); + if ((ports = jack_get_ports(client, NULL, NULL, 0)) == NULL) { + fprintf (stderr, "jack_get_ports() returned NULL."); + goto cleanup; + } for (i = 0; ports[i]; ++i) { // skip over any that don't match ALL of the strings presented at command line @@ -211,6 +214,8 @@ } } } + +cleanup: jack_client_close (client); exit (0); } Index: jack/jack.h =================================================================== --- jack/jack.h (Revision 4066) +++ jack/jack.h (Arbeitskopie) @@ -869,8 +869,8 @@ * If zero, no selection based on flags will be carried out. * * @return a NULL-terminated array of ports that match the specified - * arguments. The caller is responsible for calling jack_free(3) any - * non-NULL returned value. + * arguments, or NULL on error. The caller is responsible for calling + * jack_free(3) any non-NULL returned value. * * @see jack_port_name_size(), jack_port_type_size() */