[lsan] Make __lsan_do_leak_check() honor the detect_leaks flag.

Also move detect_leaks to common flags.