Commit bfde7f2
committed
Initialize automaticly freed variables where the function could return before the first assignment
GCC 13.1.1 warned on some places like this:
In file included from /usr/include/glib-2.0/glib.h:117,
from ../modulemd/modulemd-translation-entry.c:14:
In function ‘g_autoptr_cleanup_generic_gfree’,
inlined from ‘modulemd_translation_entry_parse_yaml’ at ../modulemd/modulemd-translation-entry.c:39
8:21:
/usr/include/glib-2.0/glib/glib-autocleanups.h:30:3: warning: ‘value’ may be used uninitialized [-Wmaybe-uninitialized]
30 | g_free (*pp);
| ^~~~~~~~~~~~
../modulemd/modulemd-translation-entry.c: In function ‘modulemd_translation_entry_parse_yaml’:
../modulemd/modulemd-translation-entry.c:398:21: note: ‘value’ was declared here
398 | g_autofree gchar *value;
| ^~~~~
Automatic variables with a cleanup attribute are automatically
deinicialized when they go out of scope, but they are not
automatically initialized when defined.
This patch adds the missing initialization.1 parent 9f0c090 commit bfde7f2
File tree
4 files changed
+7
-7
lines changed- modulemd
- tests
4 files changed
+7
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
395 | 395 | | |
396 | 396 | | |
397 | 397 | | |
398 | | - | |
| 398 | + | |
399 | 399 | | |
400 | 400 | | |
401 | 401 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
| 41 | + | |
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
| 41 | + | |
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| |||
146 | 146 | | |
147 | 147 | | |
148 | 148 | | |
149 | | - | |
| 149 | + | |
150 | 150 | | |
151 | 151 | | |
152 | 152 | | |
| |||
426 | 426 | | |
427 | 427 | | |
428 | 428 | | |
429 | | - | |
| 429 | + | |
430 | 430 | | |
431 | 431 | | |
432 | 432 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
| 46 | + | |
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| |||
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
140 | | - | |
| 140 | + | |
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
| |||
0 commit comments