[PATCH 5/7] remoteDispatchDomainMigratePrepare: Don't pass uninitialized variable to VIR_FREE

Ján Tomko jtomko at redhat.com
Thu Jun 11 10:12:05 UTC 2020


On a Thursday in 2020, Peter Krempa wrote:
>'uri_out' may be passed to VIR_FREE uninitialized if 'conn' is NULL.
>Unfortunately the compiler isn't able to detect this problem when
>VIR_FREE is implemented using g_clear_pointer. Initialize the variable.
>
>Signed-off-by: Peter Krempa <pkrempa at redhat.com>
>---
> src/remote/remote_daemon_dispatch.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/src/remote/remote_daemon_dispatch.c b/src/remote/remote_daemon_dispatch.c
>index 6f67d2fb30..69e9aa09b9 100644
>--- a/src/remote/remote_daemon_dispatch.c
>+++ b/src/remote/remote_daemon_dispatch.c
>@@ -3030,7 +3030,7 @@ remoteDispatchDomainMigratePrepare(virNetServerPtr server G_GNUC_UNUSED,
>     char *cookie = NULL;
>     int cookielen = 0;
>     char *uri_in;
>-    char **uri_out;
>+    char **uri_out = NULL;
>     char *dname;
>     int rv = -1;
>     virConnectPtr conn = remoteGetHypervisorConn(client);

Same problem is present in:

     remoteDispatchDomainMigratePrepare2
     remoteDispatchDomainMigratePrepare3
     remoteDispatchDomainMigratePrepare3Params

Reviewed-by: Ján Tomko <jtomko at redhat.com>

Jano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20200611/f24299d7/attachment-0001.sig>


More information about the libvir-list mailing list