VIRT_RETURN_STRING() does immediate return. Therefore,
efree(uuid) is never called and thus leaked. Moreover, there's no
reason for dynamically allocated uuid buffer (in contrast to our
misuse of large static buffers).
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/libvirt-nwfilter.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/src/libvirt-nwfilter.c b/src/libvirt-nwfilter.c
index cd082a5..1b5dbdc 100644
--- a/src/libvirt-nwfilter.c
+++ b/src/libvirt-nwfilter.c
@@ -145,12 +145,11 @@ PHP_FUNCTION(libvirt_nwfilter_get_uuid_string)
{
php_libvirt_nwfilter *nwfilter = NULL;
zval *znwfilter;
- char *uuid = NULL;
+ char uuid[VIR_UUID_STRING_BUFLEN];
int ret = -1;
GET_NWFILTER_FROM_ARGS("r", &znwfilter);
- uuid = (char *) emalloc(VIR_UUID_STRING_BUFLEN);
ret = virNWFilterGetUUIDString(nwfilter->nwfilter, uuid);
DPRINTF("%s: virNWFilterGetUUIDString(%p) returned %d (%s)\n", PHPFUNC,
@@ -160,7 +159,6 @@ PHP_FUNCTION(libvirt_nwfilter_get_uuid_string)
RETURN_FALSE;
VIRT_RETURN_STRING(uuid);
- efree(uuid);
}
/*
--
2.13.6