Skip to content
This repository was archived by the owner on Feb 8, 2021. It is now read-only.

Commit 4475e2d

Browse files
committed
fix possible memory leak
We are overriding container->image when passed container->scsiaddr. Make sure we also free its memory if caller also passes the image field. Signed-off-by: Peng Tao <bergwolf@gmail.com>
1 parent 2c12120 commit 4475e2d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/container.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,8 +523,10 @@ static int hyper_container_init(void *data)
523523
char dev[128];
524524
char *options = NULL;
525525

526-
if (container->scsiaddr)
526+
if (container->scsiaddr) {
527+
free(container->image);
527528
hyper_find_sd(container->scsiaddr, &container->image);
529+
}
528530

529531
sprintf(dev, "/dev/%s", container->image);
530532
fprintf(stdout, "device %s\n", dev);

0 commit comments

Comments
 (0)