Skip to content

Commit

Permalink
libkmod: Simplify lookup_builtin_file()
Browse files Browse the repository at this point in the history
Use cleanup attribute.

Signed-off-by: Lucas De Marchi <[email protected]>
Link: #233
  • Loading branch information
lucasdemarchi committed Nov 12, 2024
1 parent 317f89a commit 5322bb8
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions libkmod/libkmod.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 5322bb8

Please sign in to comment.