Ticket #24 (closed defect: fixed)
Memory being used after free
| Reported by: | leland_lucius | Owned by: | aknudsen |
|---|---|---|---|
| Priority: | major | Milestone: | |
| Component: | host-api-jack | Version: | 2.0 |
| Keywords: | Cc: |
Description
In pa_jack.c/BuildDeviceList(), regex_pattern and tmp_client_name are allocated from the deviceInfoMemory group when the routine is entered. But, they are freed when the PaUtil?_FreeAllAllocations() is executed a few statements later causing memory overlays.
The attached patch corrects this:
--- /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
Attachments
Change History
Note: See
TracTickets for help on using
tickets.
