polkit-github-migration-bot / t4_polkit

Other
0 stars 0 forks source link

pkexec: fix uninitialized pointer warning - [merged] #397

Closed polkit-github-migration-bot closed 9 months ago

polkit-github-migration-bot commented 1 year ago

In gitlab.freedesktop.org by vmihalko on Aug 9, 2023, 14:04

Link to the original merge request: https://gitlab.freedesktop.org/polkit/polkit/-/merge_requests/187 This merge request consists of the following commits:

The following warning occurs during the build* process:

[71/82] Compiling C object src/programs/pkexec.p/pkexec.c.o
../src/programs/pkexec.c: In function ‘main’:
../src/programs/pkexec.c:805:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
  805 |   gchar *cmdline_short = NULL;
      |   ^~~~~
../src/programs/pkexec.c:1074:3: warning: ‘cmdline_short’ may be used uninitialized [-Wmaybe-uninitialized]
 1074 |   g_free (cmdline_short);
      |   ^~~~~~~~~~~~~~~~~~~~~~
../src/programs/pkexec.c:805:10: note: ‘cmdline_short’ was declared here
  805 |   gchar *cmdline_short = NULL;
      |          ^~~~~~~~~~~~~

This commit changes the local variable cmdline_short to a global variable and fixes the above warning.

*

$ meson setup build; meson compile -C build

Resolves: https://gitlab.freedesktop.org/polkit/polkit/-/issues/201")