fixed various memory leaks and potential segfaults

git-svn-id: https://vsmartcard.svn.sourceforge.net/svnroot/vsmartcard@70 96b47cad-a561-4643-ad3b-153ac7d7599c
This commit is contained in:
frankmorgner
2010-04-12 19:54:43 +00:00
parent d8ababbf96
commit 535a2ea9f1
4 changed files with 74 additions and 40 deletions

View File

@@ -29,7 +29,6 @@
#include "ccid.h"
#include "pace.h"
//static const char *app_name = "ccid";
static sc_context_t *ctx = NULL;
static sc_card_t *card_in_slot[SC_MAX_SLOTS];
static sc_reader_t *reader;
@@ -118,7 +117,11 @@ int ccid_initialize(int reader_id, int verbose)
{
unsigned int i, reader_count;
SC_TEST_RET(ctx, sc_context_create(&ctx, NULL), "Failed to create initial context.");
int r = sc_context_create(&ctx, NULL);
if (r < 0) {
printf("Failed to create initial context: %s", sc_strerror(r));
return r;
}
ctx->debug = verbose;