Skip to content

Commit

Permalink
Fixed some memory allocaton problems
Browse files Browse the repository at this point in the history
Some passport images are bigger
  • Loading branch information
rubund committed Dec 13, 2014
1 parent 46a5a00 commit d2bfdd4
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/mrtdreader.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,12 @@ int main(int argc, char **argv)
mrtd_bac_get_kmrz(pn, dob, eov, buffer);
kmrz = buffer;
}
if(pn != NULL)
free(pn);
if(dob != NULL)
free(dob);
if(eov != NULL)
free(eov);


signal(SIGINT, forcestop);
Expand Down Expand Up @@ -215,7 +221,8 @@ int main(int argc, char **argv)
printf("======================\nChallenge successful!\n======================\n");

printf("\n");
uint8_t filecontent[17000];
uint8_t *filecontent = NULL;
filecontent = malloc(50000);
int filecontentlength;


Expand Down Expand Up @@ -264,6 +271,8 @@ int main(int argc, char **argv)

nfc_close(pnd);
nfc_exit(context);
if(filecontent != NULL)
free(filecontent);
return 0;

failed:
Expand All @@ -277,6 +286,8 @@ int main(int argc, char **argv)
free(dob);
if(eov != NULL)
free(eov);
if(filecontent != NULL)
free(filecontent);
return -1;
}

0 comments on commit d2bfdd4

Please sign in to comment.