mirror of
https://gitlab.xiph.org/xiph/icecast-server.git
synced 2025-02-02 15:07:36 -05:00
Fix: memory leak and race condition fix
This commit is contained in:
parent
2a99aa0f0b
commit
857264acdc
@ -613,6 +613,7 @@ void auth_stack_release(auth_stack_t *stack) {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
auth_release(stack->auth);
|
auth_release(stack->auth);
|
||||||
|
auth_stack_release(stack->next);
|
||||||
thread_mutex_destroy(&stack->lock);
|
thread_mutex_destroy(&stack->lock);
|
||||||
free(stack);
|
free(stack);
|
||||||
}
|
}
|
||||||
@ -631,9 +632,9 @@ int auth_stack_next(auth_stack_t **stack) {
|
|||||||
return -1;
|
return -1;
|
||||||
thread_mutex_lock(&(*stack)->lock);
|
thread_mutex_lock(&(*stack)->lock);
|
||||||
next = (*stack)->next;
|
next = (*stack)->next;
|
||||||
|
auth_stack_addref(next);
|
||||||
thread_mutex_unlock(&(*stack)->lock);
|
thread_mutex_unlock(&(*stack)->lock);
|
||||||
auth_stack_release(*stack);
|
auth_stack_release(*stack);
|
||||||
auth_stack_addref(next);
|
|
||||||
*stack = next;
|
*stack = next;
|
||||||
if (!next)
|
if (!next)
|
||||||
return 1;
|
return 1;
|
||||||
@ -656,7 +657,9 @@ int auth_stack_push(auth_stack_t **stack, auth_t *auth) {
|
|||||||
auth_addref(auth);
|
auth_addref(auth);
|
||||||
|
|
||||||
if (*stack) {
|
if (*stack) {
|
||||||
return auth_stack_append(*stack, next);
|
auth_stack_append(*stack, next);
|
||||||
|
auth_stack_release(next);
|
||||||
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
*stack = next;
|
*stack = next;
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user