Skip to content

Conversation

@l1b3r
Copy link
Contributor

@l1b3r l1b3r commented Sep 18, 2019

OAuthService::setupRefreshTimer is called multiple times from several places in the code, e.g. from the constructor of the service or when a storage is changed via OAuthService::setStorage.

The setupRefreshTimer is itself subscribing to OAuthService::events each time it's called, and the subscriptions get stacked creating at the very least a memory leak. In the worst case, this can also lead to undefined behavior and race conditions since the subscription handler of this.events... in setupRefreshTimer is calling setupExpirationTimers which in turn is also performing subscriptions.

This PR adds a resubscription procedure to setupRefreshTimer which will unsubscribe from OAuthService::events before subscribing to them again.

@manfredsteyer manfredsteyer merged commit d49021a into manfredsteyer:master Mar 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants