Stop and join sc_file_pusher only if initialized
The sc_file_pusher is lazy-initialized, but it was stopped and joined in all cases (accessing uninitialized values). Detected by poisoning the struct scrcpy instance with ASAN enabled.
This commit is contained in:
parent
d93582724d
commit
46f6918179
1 changed files with 10 additions and 6 deletions
|
@ -172,14 +172,18 @@ sc_file_pusher_start(struct sc_file_pusher *fp) {
|
|||
|
||||
void
|
||||
sc_file_pusher_stop(struct sc_file_pusher *fp) {
|
||||
if (fp->initialized) {
|
||||
sc_mutex_lock(&fp->mutex);
|
||||
fp->stopped = true;
|
||||
sc_cond_signal(&fp->event_cond);
|
||||
sc_intr_interrupt(&fp->intr);
|
||||
sc_mutex_unlock(&fp->mutex);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
sc_file_pusher_join(struct sc_file_pusher *fp) {
|
||||
if (fp->initialized) {
|
||||
sc_thread_join(&fp->thread, NULL);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue