Skip to content

Commit

Permalink
libkmod: Plug memory leak on error path
Browse files Browse the repository at this point in the history
Fix memory leak on error path introduced with read_u32 error checks.

Signed-off-by: Tobias Stoeckmann <[email protected]>
Reviewed-by: Emil Velikov <[email protected]>
Link: #153
Signed-off-by: Lucas De Marchi <[email protected]>
  • Loading branch information
stoeckmann authored and lucasdemarchi committed Sep 28, 2024
1 parent ed44595 commit f996293
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion libkmod/libkmod-index.c
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,10 @@ struct index_file *index_file_open(const char *filename)
goto err;

new->file = file;
if (read_u32(new->file, &new->root_offset) < 0)
if (read_u32(new->file, &new->root_offset) < 0) {
free(new);
goto err;
}

errno = 0;
return new;
Expand Down

0 comments on commit f996293

Please sign in to comment.