mirror of
https://github.com/flatpak/flatpak.git
synced 2026-01-24 23:58:10 -05:00
dir: Consistently initialize g_autofree variables
All g_autofree and g_autoptr variables should be initialized, either with a value or NULL, and some gcc versions warn if they are not. This particular instance was harmless, because we initialized regexp to either NULL or a valid non-NULL value as the first statement of the function, so there was no way to return before regexp was initialized; but if we introduced an early-return such as a g_return_val_if_fail before the current first statement, then that early return would have caused uninitialized stack contents to be freed, likely resulting in a crash. Signed-off-by: Simon McVittie <smcv@collabora.com>
This commit is contained in:
@@ -4402,7 +4402,7 @@ flatpak_dir_config_append_pattern (FlatpakDir *self,
|
||||
GError **error)
|
||||
{
|
||||
g_autoptr(GPtrArray) patterns = flatpak_dir_get_config_patterns (self, key);
|
||||
g_autofree char *regexp;
|
||||
g_autofree char *regexp = NULL;
|
||||
gboolean already_present;
|
||||
g_autofree char *merged_patterns = NULL;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user