qga: Don't access global variable in run_agent_once()
authorMichal Privoznik <mprivozn@redhat.com>
Thu, 5 Dec 2024 16:18:45 +0000 (17:18 +0100)
committerKonstantin Kostiuk <kkostiuk@redhat.com>
Wed, 18 Dec 2024 11:46:16 +0000 (13:46 +0200)
The run_agent_once() function is already given GAState via an
argument. There's no need to access the global ga_state variable
which points to the argument anyways (thanks to
initialize_agent()). Worse, some parts of the function use the
argument and the other use the global variable.  Stick with the
function argument.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com>
Link: https://lore.kernel.org/r/8ae7f5d5032b14a5b956fe8aaf47bae5ca401699.1733414906.git.mprivozn@redhat.com
Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
qga/main.c

index 50186760bf06087b9ec2563173e17a100878f18f..4a695235f0101b671b41a699b3062b2ef5368dd4 100644 (file)
@@ -1519,7 +1519,7 @@ static int run_agent_once(GAState *s)
         return EXIT_FAILURE;
     }
 
-    g_main_loop_run(ga_state->main_loop);
+    g_main_loop_run(s->main_loop);
 
     if (s->channel) {
         ga_channel_free(s->channel);