Fix memory leak for sc_establish_context
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@214 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
parent
61fc1f9327
commit
3adef373bf
|
@ -150,8 +150,10 @@ int sc_establish_context(struct sc_context **ctx_out)
|
||||||
ctx->log_errors = 1;
|
ctx->log_errors = 1;
|
||||||
rv = SCardEstablishContext(SCARD_SCOPE_GLOBAL, "localhost", NULL,
|
rv = SCardEstablishContext(SCARD_SCOPE_GLOBAL, "localhost", NULL,
|
||||||
&ctx->pcsc_ctx);
|
&ctx->pcsc_ctx);
|
||||||
if (rv != SCARD_S_SUCCESS)
|
if (rv != SCARD_S_SUCCESS) {
|
||||||
|
free(ctx);
|
||||||
return SC_ERROR_CONNECTING_TO_RES_MGR;
|
return SC_ERROR_CONNECTING_TO_RES_MGR;
|
||||||
|
}
|
||||||
SCardListReaders(ctx->pcsc_ctx, NULL, NULL,
|
SCardListReaders(ctx->pcsc_ctx, NULL, NULL,
|
||||||
(LPDWORD) &reader_buf_size);
|
(LPDWORD) &reader_buf_size);
|
||||||
if (reader_buf_size < 2) {
|
if (reader_buf_size < 2) {
|
||||||
|
|
Loading…
Reference in New Issue