Browse Source

Better memory allocation error checking on client (library) side.

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@3768 0c269be4-1314-0410-8aa9-9f06e86f4224
tags/v1.9.4
sletz 15 years ago
parent
commit
ea9de08398
5 changed files with 23 additions and 14 deletions
  1. +5
    -1
      ChangeLog
  2. +3
    -1
      common/JackAPI.cpp
  3. +1
    -8
      common/JackClient.cpp
  4. +6
    -0
      common/JackGraphManager.cpp
  5. +8
    -4
      common/jack/jslist.h

+ 5
- 1
ChangeLog View File

@@ -25,7 +25,11 @@ Paul Davis
Jackdmp changes log Jackdmp changes log
--------------------------- ---------------------------


2009-11-10 Stephane Letz <letz@grame.fr>
2009-11-12 Stephane Letz <letz@grame.fr>
* Better memory allocation error checking on client (library) side.

2009-11-11 Stephane Letz <letz@grame.fr>
* Correct JackCoreAudio driver when empty strings are given as -C, -P or -d parameter. * Correct JackCoreAudio driver when empty strings are given as -C, -P or -d parameter.




+ 3
- 1
common/JackAPI.cpp View File

@@ -1943,5 +1943,7 @@ jack_get_version_string()


EXPORT void jack_free(void* ptr) EXPORT void jack_free(void* ptr)
{ {
free(ptr);
if (ptr) {
free(ptr);
}
} }

+ 1
- 8
common/JackClient.cpp View File

@@ -988,14 +988,7 @@ char* JackClient::GetInternalClientName(int ref)
char name_res[JACK_CLIENT_NAME_SIZE + 1]; char name_res[JACK_CLIENT_NAME_SIZE + 1];
int result = -1; int result = -1;
fChannel->GetInternalClientName(GetClientControl()->fRefNum, ref, name_res, &result); fChannel->GetInternalClientName(GetClientControl()->fRefNum, ref, name_res, &result);

if (result < 0) {
return NULL;
} else {
char* name = (char*)malloc(strlen(name_res));
strcpy(name, name_res);
return name;
}
return (result < 0) ? NULL : strdup(name_res);
} }


int JackClient::InternalClientHandle(const char* client_name, jack_status_t* status) int JackClient::InternalClientHandle(const char* client_name, jack_status_t* status)


+ 6
- 0
common/JackGraphManager.cpp View File

@@ -702,6 +702,9 @@ const char** JackGraphManager::GetConnections(jack_port_id_t port_index)
{ {
const char** res = (const char**)malloc(sizeof(char*) * CONNECTION_NUM_FOR_PORT); const char** res = (const char**)malloc(sizeof(char*) * CONNECTION_NUM_FOR_PORT);
UInt16 cur_index, next_index; UInt16 cur_index, next_index;
if (!res)
return NULL;


do { do {
cur_index = GetCurrentIndex(); cur_index = GetCurrentIndex();
@@ -782,6 +785,9 @@ const char** JackGraphManager::GetPorts(const char* port_name_pattern, const cha
{ {
const char** res = (const char**)malloc(sizeof(char*) * PORT_NUM); const char** res = (const char**)malloc(sizeof(char*) * PORT_NUM);
UInt16 cur_index, next_index; UInt16 cur_index, next_index;
if (!res)
return NULL;
do { do {
cur_index = GetCurrentIndex(); cur_index = GetCurrentIndex();


+ 8
- 4
common/jack/jslist.h View File

@@ -48,8 +48,10 @@ jack_slist_alloc (void)
JSList *new_list; JSList *new_list;


new_list = (JSList*)malloc(sizeof(JSList)); new_list = (JSList*)malloc(sizeof(JSList));
new_list->data = NULL;
new_list->next = NULL;
if (new_list) {
new_list->data = NULL;
new_list->next = NULL;
}


return new_list; return new_list;
} }
@@ -61,8 +63,10 @@ jack_slist_prepend (JSList* list, void* data)
JSList *new_list; JSList *new_list;


new_list = (JSList*)malloc(sizeof(JSList)); new_list = (JSList*)malloc(sizeof(JSList));
new_list->data = data;
new_list->next = list;
if (new_list) {
new_list->data = data;
new_list->next = list;
}


return new_list; return new_list;
} }


Loading…
Cancel
Save