Skip to content

Commit

Permalink
repo: Autofree contents of input_mfile
Browse files Browse the repository at this point in the history
Coverity points out that we have memory leak from
g_mapped_file_get_contents(input_mfile).
  • Loading branch information
lukewarmtemp committed Jun 12, 2024
1 parent b42ef62 commit 81125ff
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/libostree/ostree-repo-static-delta-processing.c
Original file line number Diff line number Diff line change
Expand Up @@ -423,10 +423,11 @@ dispatch_bspatch (OstreeRepo *repo, StaticDeltaExecutionState *state, GCancellab
struct bspatch_stream stream;
stream.read = bspatch_read;
stream.opaque = &opaque;
if (bspatch ((const guint8 *)g_mapped_file_get_contents (input_mfile),
g_mapped_file_get_length (input_mfile), buf, state->content_size, &stream)
g_autofree const guint8 *old = (const guint8 *)g_mapped_file_get_contents (input_mfile);
if (bspatch (old, g_mapped_file_get_length (input_mfile), buf,
state->content_size, &stream)
< 0)
return glnx_throw (error, "bsdiff patch failed");
return glnx_throw (error, "bsdiff patch failed");

if (!_ostree_repo_bare_content_write (repo, &state->content_out, buf, state->content_size,
cancellable, error))
Expand Down

0 comments on commit 81125ff

Please sign in to comment.