Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Explicitly free lock objects #416

Merged
merged 1 commit into from
Nov 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/sentry_sync.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ sentry__bgworker_decref(sentry_bgworker_t *bgw)
if (bgw->free_state) {
bgw->free_state(bgw->state);
}
sentry__mutex_free(&bgw->task_lock);
sentry_free(bgw);
}

Expand Down
4 changes: 4 additions & 0 deletions src/sentry_sync.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ typedef struct sentry__winmutex_s sentry_mutex_t;
# define sentry__mutex_lock(Lock) sentry__winmutex_lock(Lock)
# define sentry__mutex_unlock(Lock) \
LeaveCriticalSection(&(Lock)->critical_section)
# define sentry__mutex_free(Lock) \
DeleteCriticalSection(&(Lock)->critical_section)

# define sentry__thread_spawn(ThreadId, Func, Data) \
(*ThreadId = CreateThread(NULL, 0, Func, Data, 0, NULL), \
Expand Down Expand Up @@ -215,6 +217,8 @@ typedef pthread_cond_t sentry_cond_t;
pthread_mutex_unlock(Mutex); \
} \
} while (0)
# define sentry__mutex_free(Lock) pthread_mutex_destroy(Lock)

# define sentry__cond_init(CondVar) \
do { \
sentry_cond_t tmp = PTHREAD_COND_INITIALIZER; \
Expand Down