Check for NULL before dereferencing.

Reported by STACK

http://css.csail.mit.edu/stack/

Change-Id: Id7959c8217f46313ecf35a271efaf5f703fde2dc
This commit is contained in:
Martin Paljak 2013-11-25 19:25:43 +02:00
parent f09dae493c
commit 1acb4adc3e
1 changed files with 3 additions and 2 deletions

View File

@ -319,10 +319,11 @@ int sc_lock(sc_card_t *card)
{
int r = 0, r2 = 0;
LOG_FUNC_CALLED(card->ctx);
if (card == NULL)
return SC_ERROR_INVALID_ARGUMENTS;
LOG_FUNC_CALLED(card->ctx);
r = sc_mutex_lock(card->ctx, card->mutex);
if (r != SC_SUCCESS)
return r;