From 50c82157e18ed9e65eade7c901798f4a56ae1990 Mon Sep 17 00:00:00 2001 From: Osier Yang Date: Fri, 2 Sep 2011 12:49:24 +0800 Subject: [PATCH] API: Init conn in case of it might be used uninitialized There is a goto before "conn" is initialized. --- src/libvirt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libvirt.c b/src/libvirt.c index 4284954e00..eca919ad0e 100644 --- a/src/libvirt.c +++ b/src/libvirt.c @@ -15225,12 +15225,13 @@ virDomainMigrateGetMaxSpeed(virDomainPtr domain, return -1; } + conn = domain->conn; + if (!bandwidth) { virLibDomainError(VIR_ERR_INVALID_ARG, __FUNCTION__); goto error; } - conn = domain->conn; if (conn->flags & VIR_CONNECT_RO) { virLibDomainError(VIR_ERR_OPERATION_DENIED, __FUNCTION__); goto error;