--- /orig/pa_jack.c	2006-09-23 02:04:42.000000000 -0500
+++ pa_jack.c	2006-09-24 02:23:39.000000000 -0500
@@ -466,12 +466,12 @@
 
     const char **jack_ports = NULL;
     char **client_names = NULL;
-    char *regex_pattern = MALLOC( jack_client_name_size() + 3 );
+    char *regex_pattern = NULL;
     int port_index, client_index, i;
     double globalSampleRate;
     regex_t port_regex;
     unsigned long numClients = 0, numPorts = 0;
-    char *tmp_client_name = MALLOC( jack_client_name_size() );
+    char *tmp_client_name = NULL;
 
     commonApi->info.defaultInputDevice = paNoDevice;
     commonApi->info.defaultOutputDevice = paNoDevice;
@@ -484,6 +484,9 @@
      * associated with the previous list */
     PaUtil_FreeAllAllocations( jackApi->deviceInfoMemory );
 
+    regex_pattern = MALLOC( jack_client_name_size() + 3 );
+    tmp_client_name = MALLOC( jack_client_name_size() );
+
     /* We can only retrieve the list of clients indirectly, by first
      * asking for a list of all ports, then parsing the port names
      * according to the client_name:port_name convention (which is
