diff options
author | Simon McVittie <smcv@collabora.com> | 2023-03-20 11:18:43 +0000 |
---|---|---|
committer | Simon McVittie <smcv@collabora.com> | 2023-03-20 12:19:15 +0000 |
commit | 43085c0e2a3ccfe9e3735b034a5d6a9fc6f5c7b4 (patch) | |
tree | f8aa465b9547ab92b664d6a47b325699a0b26021 | |
parent | ec6ca9b6a6b50bbd3e768c69ea87ff1a3b0ffa0f (diff) | |
download | flatpak-43085c0e2a3ccfe9e3735b034a5d6a9fc6f5c7b4.tar.gz |
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>
-rw-r--r-- | common/flatpak-dir.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/common/flatpak-dir.c b/common/flatpak-dir.c index 01e6b8ff..2f80a70f 100644 --- a/common/flatpak-dir.c +++ b/common/flatpak-dir.c @@ -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; |