Fix memory leaks when using object_property_get_str()

-----BEGIN PGP SIGNATURE-----
 
 iQIcBAABCAAGBQJaw4jqAAoJECgHk2+YTcWmEFcQAJcNSNyo/jqqnPEJyNo0+Yoy
 GWP/5sZ8fDKFWWnhFg/ZXpp+8Z4xh/25vriCjsBhQRrxaQYIeCyccUEFiGf17VK4
 jSa83rzuq4HMnLip4IT+j0ywRLa1wM79WaC//LpbRVGVdyCtuhwsQkMEOLiJbDdM
 RMh4cqhrpWenSTD/FBhTc9O37hea1ly5Iytw0+hx9cC4x1SiEwU1deT3Moimav1K
 ptRUqDtU8dUTxmmj7BIFyarGw++Um+eL+oabh49CRvn1eqy2tCBHMg8vjbRxiOTX
 iX0J3fb/YefBnZBGJtGqXXZYDC+f6Xblnmad05GVSuNPctUp+pKsflMtgjFfmuT4
 VZm0FFiW5QgF9a85WDNKhjMlidLtcyfHz7G7GrgIJ2vZsigg4tAmFC2D0+Ep2xxK
 UtXInPYqvwGIBUoEggZ5luWxxM0LEKK/Jhp9TjVvnIAdxj4/usigYjQ4Xxs4Q5nF
 tU5yFBkdK3t5CF3PMBZd18QCUnP26LE6Nmp3oGPdhOI1HjHXmV/GT123XB9EcIxJ
 xZSkhYfK4Lo5lXeo/6BLqzU8WJZmqXzBcVFnJZzY6dsQlG7m7NhoVJULXyjBymAM
 nbxrlT05dp7nsWLkHIiHEwx1UkjF7vZcf5+QM88p83820+qhj8d16GM2a7kvfnkC
 XC3hbdLcuWZ0WbYcg+B3
 =HHvc
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/ehabkost/tags/x86-next-pull-request' into staging

Fix memory leaks when using object_property_get_str()

# gpg: Signature made Tue 03 Apr 2018 15:00:10 BST
# gpg:                using RSA key 2807936F984DC5A6
# gpg: Good signature from "Eduardo Habkost <ehabkost@redhat.com>"
# Primary key fingerprint: 5A32 2FD5 ABC4 D3DB ACCF  D1AA 2807 936F 984D C5A6

* remotes/ehabkost/tags/x86-next-pull-request:
  sev/i386: fix memory leak in sev_guest_init()
  exec: fix memory leak in find_max_supported_pagesize()

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2018-04-04 11:13:52 +01:00
commit 094b62cd9c
2 changed files with 4 additions and 1 deletions

1
exec.c
View File

@ -1495,6 +1495,7 @@ static int find_max_supported_pagesize(Object *obj, void *opaque)
mem_path = object_property_get_str(obj, "mem-path", NULL);
if (mem_path) {
long hpsize = qemu_mempath_getpagesize(mem_path);
g_free(mem_path);
if (hpsize < *hpsize_min) {
*hpsize_min = hpsize;
}

View File

@ -748,9 +748,11 @@ sev_guest_init(const char *id)
if (s->sev_fd < 0) {
error_report("%s: Failed to open %s '%s'", __func__,
devname, strerror(errno));
goto err;
}
g_free(devname);
if (s->sev_fd < 0) {
goto err;
}
ret = sev_platform_ioctl(s->sev_fd, SEV_PLATFORM_STATUS, &status,
&fw_error);