mirror of
https://github.com/clearlinux/hyperstart.git
synced 2026-08-27 11:56:04 +00:00
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>
This commit is contained in:
+3
-1
@@ -523,8 +523,10 @@ static int hyper_container_init(void *data)
|
||||
char dev[128];
|
||||
char *options = NULL;
|
||||
|
||||
if (container->scsiaddr)
|
||||
if (container->scsiaddr) {
|
||||
free(container->image);
|
||||
hyper_find_sd(container->scsiaddr, &container->image);
|
||||
}
|
||||
|
||||
sprintf(dev, "/dev/%s", container->image);
|
||||
fprintf(stdout, "device %s\n", dev);
|
||||
|
||||
Reference in New Issue
Block a user