diff options
author | Stef Walter <stefw@collabora.co.uk> | 2011-11-17 15:26:55 +0100 |
---|---|---|
committer | Stef Walter <stefw@collabora.co.uk> | 2011-11-21 10:28:27 +0100 |
commit | f3b9d46c75675e9b4b451164dd32ed9b1af0dfb1 (patch) | |
tree | 5b66cf37d54e3b447e3087cc27b03eeb7ae332f7 /gck/gck-mock.c | |
parent | 97cd79171dfbba24394f070f3946b20c2d518d2d (diff) | |
download | gcr-f3b9d46c75675e9b4b451164dd32ed9b1af0dfb1.tar.gz |
Add valgrind memory checking and fix up errors
* This is especially necessary after migrating to EggBytes
since it's reference counted and an easy sourc of memory leaks
* Remove threading from testing framework, as gcr isn't threadsafe
in all parts.
* Fix bugs discovered in memory checking.
* Fix up some of the testing stuff.
Diffstat (limited to 'gck/gck-mock.c')
-rw-r--r-- | gck/gck-mock.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/gck/gck-mock.c b/gck/gck-mock.c index a6a60b2..a1fdba9 100644 --- a/gck/gck-mock.c +++ b/gck/gck-mock.c @@ -721,13 +721,17 @@ gck_mock_C_SetPIN (CK_SESSION_HANDLE hSession, CK_UTF8CHAR_PTR pOldPin, CK_ULONG ulOldLen, CK_UTF8CHAR_PTR pNewPin, CK_ULONG ulNewLen) { Session *session; + gboolean match; gchar *old; session = g_hash_table_lookup (the_sessions, GUINT_TO_POINTER (hSession)); g_return_val_if_fail (session, CKR_SESSION_HANDLE_INVALID); old = g_strndup ((gchar*)pOldPin, ulOldLen); - if (!old || !g_str_equal (old, the_pin)) + match = old && g_str_equal (old, the_pin); + g_free (old); + + if (!match) return CKR_PIN_INCORRECT; g_free (the_pin); |