Fix queue items memory leak.

(Logical change 1.49)


git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@153 fd59a12c-fef9-0310-b244-a6a79926bd2f
This commit is contained in:
Mark Haverkamp 2004-07-30 17:49:14 +00:00
parent b6aef62e74
commit aa5a8389ef

View File

@ -180,11 +180,28 @@ struct message_overlay {
static void evtHandleInstanceDestructor(void *instance)
{
struct event_instance *evti = instance;
void **msg;
int empty;
/*
* Empty out the queue if there are any pending messages
*/
while ((saQueueIsEmpty(&evti->ei_inq, &empty) == SA_OK) && !empty) {
saQueueItemGet(&evti->ei_inq, &msg);
saQueueItemRemove(&evti->ei_inq);
free(*msg);
}
/*
* clean up the queue itself
*/
if (evti->ei_inq.items) {
free(evti->ei_inq.items);
}
/*
* Disconnect from the server
*/
if (evti->ei_fd != -1) {
shutdown(evti->ei_fd, 0);
close(evti->ei_fd);
@ -409,6 +426,7 @@ saEvtDispatch(
msg = *queue_msg;
memcpy(&dispatch_data, msg, msg->size);
saQueueItemRemove(&evti->ei_inq);
free(msg);
} else {
/*
* Queue empty, read response from socket