diff --git a/src/shared/specifier.c b/src/shared/specifier.c index 05f5b28bb648d..97c5fd716de31 100644 --- a/src/shared/specifier.c +++ b/src/shared/specifier.c @@ -294,7 +294,7 @@ int specifier_architecture(char specifier, const void *data, const char *root, c * installation. */ static int parse_os_release_specifier(const char *root, const char *id, char **ret) { - char *v = NULL; + _cleanup_free_ char *v = NULL; int r; assert(ret); @@ -303,7 +303,7 @@ static int parse_os_release_specifier(const char *root, const char *id, char **r if (r >= 0) /* parse_os_release() calls parse_env_file() which only sets the return value for * entries found. Let's make sure we set the return value in all cases. */ - *ret = v; + *ret = TAKE_PTR(v); /* Translate error for missing os-release file to EUNATCH. */ return r == -ENOENT ? -EUNATCH : r;