stdmem: free: only call _gcry_secmem_free if needed
* src/stdmem.c (_gcry_private_free): Check if memory is secure before calling _gcry_secmem_free to avoid unnecessarily taking secmem lock.
Unnecessarily taking secmem lock on non-secure memory can result poor
performance on multi-threaded workloads:
https://lists.gnupg.org/pipermail/gcrypt-devel/2018-August/004535.html
- Reported-by: Christian Grothoff <grothoff@gnunet.org>
- Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>