vmihalko / t2_polkit

Other
0 stars 0 forks source link

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

Closed vmihalko closed 1 year ago

vmihalko commented 1 year ago

Merges private-vmihalko-fix-uninitialized-pointer -> master

Summary

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.

* build process:

$ meson setup build; meson compile -C build

Fixes https://gitlab.freedesktop.org/polkit/polkit/-/issues/201 (uninitialized pointer warning)

vmihalko commented 1 year ago

added 1 commit

Compare with previous version

vmihalko commented 1 year ago

In GitLab by @jrybar on Aug 16, 2023, 10:50

enabled an automatic merge when the pipeline for f7ed531e16e38474d33d1bd3fb5166ec2093700c succeeds