shlomif / fc-solve

Freecell Solver - a C library for automatically solving Freecell and some other variants of card Solitaire
https://fc-solve.shlomifish.org/
MIT License
58 stars 12 forks source link

An improper locking due to the unreleased lock before program exit #83

Closed ycaibb closed 3 years ago

ycaibb commented 3 years ago

Hi developers, in the below codes, the lock instance->fcc_exit_points_output_lock could be not released before program's exit abort();. I think it is better to write fcs_lock_unlock(&instance->fcc_exit_points_output_lock); before the abort(); for better resource management and code symmetry. Thanks!

https://github.com/shlomif/fc-solve/blob/45efed24104b1c3ac80efb44904579d0fb238ae4/fc-solve/source/split_fcc_solver.c#L455-L478

Best,

shlomif commented 3 years ago

hi @ycaibb ! i'm trying to amend it now, but there may be other stale locks, and I think split-fcc-solver is unreliable any way.

shlomif commented 3 years ago

@ycaibb : hi! this commit aims to provide a symptomatic fix: https://github.com/shlomif/fc-solve/commit/934f19a754bcb0f4b292c00694e2d14e58761c53 . can this ticket be closed?

ycaibb commented 3 years ago

@shlomif Thanks~

shlomif commented 3 years ago

@ycaibb : yw , and thanks,