Skip to content

Commit

Permalink
Fix a small leak in packetbuffer free
Browse files Browse the repository at this point in the history
  • Loading branch information
katajakasa committed Oct 31, 2023
1 parent 1253b02 commit 8eef711
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/internal/kitpacketbuffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,15 @@ void Kit_FreePacketBuffer(Kit_PacketBuffer **ref) {
return;

Kit_PacketBuffer *buffer = *ref;
SDL_CondBroadcast(buffer->can_read);
SDL_CondBroadcast(buffer->can_write);
SDL_DestroyCond(buffer->can_read);
SDL_DestroyCond(buffer->can_write);
SDL_DestroyMutex(buffer->mutex);
for(size_t i = 0; i < buffer->capacity; i++) {
buffer->free_cb((void **)&buffer->packets[i]);
}
free(buffer->packets);
free(buffer);
*ref = NULL;
}
Expand Down

0 comments on commit 8eef711

Please sign in to comment.