Easy to reproduce: activate cleanup (HAS_CLEANUP) and quit the game before any quark is generated.
Fix: check that quarks is not NULL quarks_free() before doing string_free on the elements.
Fix: check that quarks is not NULL quarks_free() before doing string_free on the elements.