From b417f8d9a36fdd5723ba99d2f535d2be7b723b48 Mon Sep 17 00:00:00 2001 From: Lucas De Marchi Date: Thu, 7 Nov 2024 14:26:39 -0600 Subject: [PATCH] libkmod: Simplify lookup_builtin_file() Use cleanup attribute. Signed-off-by: Lucas De Marchi --- libkmod/libkmod.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/libkmod/libkmod.c b/libkmod/libkmod.c index cd6c8948..7262abef 100644 --- a/libkmod/libkmod.c +++ b/libkmod/libkmod.c @@ -447,11 +447,9 @@ static char *lookup_file(struct kmod_ctx *ctx, enum kmod_index index_number, static bool lookup_builtin_file(struct kmod_ctx *ctx, const char *name) { - char *line = lookup_file(ctx, KMOD_INDEX_MODULES_BUILTIN, name); - bool found = line != NULL; + _cleanup_free_ char *line = lookup_file(ctx, KMOD_INDEX_MODULES_BUILTIN, name); - free(line); - return found; + return line; } int kmod_lookup_alias_from_kernel_builtin_file(struct kmod_ctx *ctx, const char *name,