[libvirt-php][PATCH] libvirt_connect_get_all_domain_stats: Add forgotten breaks

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

 



Unfortunately, during review I haven't spotted the obvious. There's
missing break in each switch() case which will definitely produce a
segmentation fault as it causes strdup() to be called on non-string
types too. Sorry for the noise.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---

Pushed under trivial rule.

 src/libvirt-php.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/libvirt-php.c b/src/libvirt-php.c
index eb42994..698ab0f 100644
--- a/src/libvirt-php.c
+++ b/src/libvirt-php.c
@@ -2467,18 +2467,25 @@ PHP_FUNCTION(libvirt_connect_get_all_domain_stats)
 			switch (params.type) {
 			case VIR_TYPED_PARAM_INT:
 				add_assoc_long(arr2, params.field, params.value.i);
+				break;
 			case VIR_TYPED_PARAM_UINT:
 				add_assoc_long(arr2, params.field, params.value.ui);
+				break;
 			case VIR_TYPED_PARAM_LLONG:
 				add_assoc_long(arr2, params.field, params.value.l);
+				break;
 			case VIR_TYPED_PARAM_ULLONG:
 				add_assoc_long(arr2, params.field, params.value.ul);
+				break;
 			case VIR_TYPED_PARAM_DOUBLE:
 				add_assoc_double(arr2, params.field, params.value.d);
+				break;
 			case VIR_TYPED_PARAM_BOOLEAN:
 				add_assoc_bool(arr2, params.field, params.value.b);
+				break;
 			case VIR_TYPED_PARAM_STRING:
 				add_assoc_string_ex(arr2, params.field, strlen(params.field)+1, params.value.s, strlen(params.value.s)+1);
+				break;
 			}
 		}
 		name = virDomainGetName(retstats[i]->dom);
-- 
2.3.6

--
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]