]> xenbits.xensource.com Git - libvirt.git/commitdiff
Fix potential use of undefined variable in remote dispatch code
authorDaniel P. Berrange <berrange@redhat.com>
Thu, 2 May 2013 11:35:47 +0000 (12:35 +0100)
committerDaniel P. Berrange <berrange@redhat.com>
Fri, 3 May 2013 09:29:07 +0000 (10:29 +0100)
If an early dispatch check caused a jump to the 'cleanup' branch
then virTypeParamsFree() would be called with an uninitialized
'nparams' variable. Fortunately 'params' is initialized to NULL,
so the uninitialized 'nparams' variable would not be used.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
src/rpc/gendispatch.pl

index 7b930621de29384995d84803621605eb640f3cd5..8d3b013ac046827807bbd9bc30e9ef268b15a09e 100755 (executable)
@@ -495,7 +495,7 @@ elsif ($mode eq "server") {
                     push(@args_list, "args->$1.$1_len");
                 } elsif ($args_member =~ m/^remote_typed_param (\S+)<(\S+)>;/) {
                     push(@vars_list, "virTypedParameterPtr $1 = NULL");
-                    push(@vars_list, "int n$1");
+                    push(@vars_list, "int n$1 = 0;");
                     if ($call->{ProcName} eq "NodeSetMemoryParameters") {
                         push(@args_list, "priv->conn");
                     }