Skip to content

Commit

Permalink
fixed memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
frankmorgner committed Dec 18, 2017
1 parent 7059778 commit 6a08404
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pcsc-relay/src/pcsc-relay.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ static struct rf_driver *rfdriver = &driver_openpicc;
static driver_data_t *rfdriver_data = NULL;
static struct sc_driver *scdriver = &driver_pcsc;
static driver_data_t *scdriver_data = NULL;
static unsigned char *buf = NULL;
static size_t buflen = 0;

/* Forward declaration */
static void daemonize(void);
Expand Down Expand Up @@ -113,6 +115,7 @@ void cleanup(void) {
rfdriver_data = NULL;
scdriver->disconnect(scdriver_data);
scdriver_data = NULL;
free(buf);
}

void
Expand All @@ -136,9 +139,6 @@ hexdump(const char *label, unsigned char *buf, size_t len)
int main (int argc, char **argv)
{
/*printf("%s:%d\n", __FILE__, __LINE__);*/
unsigned char *buf = NULL;
size_t buflen;

unsigned char outputBuffer[MAX_EXT_BUFFER_SIZE];
size_t outputLength;

Expand Down Expand Up @@ -213,6 +213,7 @@ int main (int argc, char **argv)
daemonize();
}

cmdline_parser_free (&args_info);

while(1) {
/* get C-APDU */
Expand Down Expand Up @@ -248,7 +249,6 @@ int main (int argc, char **argv)


err:
cmdline_parser_free (&args_info);
cleanup();

exit(0);
Expand Down

0 comments on commit 6a08404

Please sign in to comment.