Skip to content

Commit

Permalink
Merge pull request #152 from flaviojs/fix-memory-leak-dev_nvram_init
Browse files Browse the repository at this point in the history
Fix memory leak in dev_nvram_init
  • Loading branch information
grossmj authored Mar 9, 2024
2 parents 9c889fc + aa2345b commit 91b210e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions common/dev_nvram.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ int dev_nvram_init(vm_instance_t *vm,char *name,

if (!(d->filename = vm_build_filename(vm,name))) {
fprintf(stderr,"NVRAM: unable to create filename.\n");
free(d);
return(-1);
}

Expand All @@ -182,6 +183,7 @@ int dev_nvram_init(vm_instance_t *vm,char *name,

if (d->dev.fd == -1) {
fprintf(stderr,"NVRAM: unable to map file '%s'\n",d->filename);
free(d);
return(-1);
}

Expand Down

0 comments on commit 91b210e

Please sign in to comment.