[libvirt-php] Fixed minor memory leak

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 src/libvirt-php.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/libvirt-php.c b/src/libvirt-php.c
index b6a848f..7870fcf 100644
--- a/src/libvirt-php.c
+++ b/src/libvirt-php.c
@@ -222,8 +222,8 @@ PHP_MINFO_FUNCTION(libvirt)
 
 	if (virGetVersion(&libVer,NULL,NULL)== 0)
 	{
-		version=emalloc(100);
-		snprintf(version, 100, "%i.%i.%i", (long)((libVer/1000000) % 1000),(long)((libVer/1000) % 1000),(long)(libVer % 1000));
+		char version[100];
+		snprintf(version, sizeof(version), "%i.%i.%i", (long)((libVer/1000000) % 1000),(long)((libVer/1000) % 1000),(long)(libVer % 1000));
 		php_info_print_table_row(2, "Libvirt version", version);
 	}
 
@@ -3883,10 +3883,12 @@ PHP_FUNCTION(libvirt_list_active_domains)
 			if (name==NULL)
 			{
 				efree (ids);
+				virDomainFree (domain);
 				RETURN_FALSE;
 			}
 
 			add_next_index_string(return_value, name, 1);
+			virDomainFree (domain);
 		}
 	}
 	efree(ids);
-- 
1.7.3.4
v

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]