fix memory leaks, bump version

git-svn-id: svn://code.dyne.org/veejay/trunk@837 eb8d1916-c9e9-0310-b8de-cf0c9472ead5
This commit is contained in:
Niels Elburg
2007-03-12 00:40:51 +00:00
parent 642f1b5860
commit a112b18141
26 changed files with 559 additions and 404 deletions

View File

@@ -148,6 +148,8 @@ typedef struct jack_driver_s
/* variables used for trying to restart the connection to jack */
bool jackd_died; /* true if jackd has died and we should try to restart it */
struct timeval last_reconnect_attempt;
char *wave_buffer;
} jack_driver_t;
@@ -514,7 +516,8 @@ static int JACK_callback (nframes_t nframes, void *arg)
TRACE("numFramesToWrite == inputFramesAvailable, advancing to next header\n");
#endif
free(this->pPlayPtr->pData); /* free the data we've played */
// free(this->pPlayPtr->pData); /* free the data we've played */
this->pPlayPtr->size = 0;
this->playptr_offset = 0;
pOldHeader = this->pPlayPtr;
this->pPlayPtr = this->pPlayPtr->pNext;
@@ -619,7 +622,7 @@ static int JACK_callback (nframes_t nframes, void *arg)
while(wh)
{
wh = wh->pNext;
free(this->pPlayPtr->pData); /* free up the app data */
// free(this->pPlayPtr->pData); /* free up the app data */
free(this->pPlayPtr); /* free the structure itself */
this->pPlayPtr = wh;
}
@@ -787,6 +790,8 @@ static int JACK_OpenDevice(jack_driver_t* this)
this->buffer_size = 0;
this->playptr_offset = 0;
this->wave_buffer = (char*) vj_calloc( 16384 * 4 * sizeof(char));
/* set up an error handler */
jack_set_error_function(JACK_Error);
@@ -1182,6 +1187,10 @@ int JACK_Close(int deviceID)
first_free_device--; /* decrement device count */
if(this->wave_buffer)
free(this->wave_buffer);
this->wave_buffer = NULL;
releaseDriver(this);
return 0;
}
@@ -1221,7 +1230,8 @@ long JACK_Write(int deviceID, char *data, unsigned long bytes)
//ERR("error allocating memory for newWaveHeader\n");
}
newWaveHeader->pData = (char*)vj_malloc(sizeof(char) * bytes); /* allocate memory for the data */
// newWaveHeader->pData = (char*)vj_malloc(sizeof(char) * bytes); /* allocate memory for the data */
newWaveHeader->pData = this->wave_buffer;
veejay_memcpy(newWaveHeader->pData, data, sizeof(char) * bytes); /* copy in the data */
newWaveHeader->size = bytes; /* update the size */
newWaveHeader->pNext = 0; /* setup the next pointer to point to null */