Verified Commit b45d911c authored by
gio-test: fix leak & maybe-uninitialized warning
GCC 8 on F29 complains: ../tests/gio-test.c: In function ‘main’: ../tests/gio-test.c:375:7: warning: ‘id’ may be used uninitialized in this function [-Wmaybe-uninitialized] g_free (id); ^~~~~~~~~~~ In the normal case, when run without arguments, 'id' will be assigned exactly once, so all is fine. If run with argument '0', 'id' will never be assigned, so the warning is legit; but in that case the test program will never exit. If run with any argument greater than 1, 'id' will be assigned more than once but only the last incarnation will be freed. Tweak the scope of the variable to match its use, and arrange for it to be freed when its watch is destroyed.
Showing with 6 additions and 6 deletions