Skip to content

Commit

Permalink
api: Error checking before NULL dereference
Browse files Browse the repository at this point in the history
Move error checking of possible null returned value before
its dereference in importBuilder.Format

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Signed-off-by: Tigran Sogomonian <[email protected]>
  • Loading branch information
Tigran Sogomonian committed Nov 28, 2024
1 parent a9b163a commit 1fa27ff
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libpod/container_commit.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ func (c *Container) Commit(ctx context.Context, destImage string, options Contai
OverrideConfig: options.CommitOptions.OverrideConfig,
}
importBuilder, err := buildah.ImportBuilder(ctx, c.runtime.store, builderOptions)
importBuilder.Format = options.PreferredManifestType
if err != nil {
return nil, err
}
importBuilder.Format = options.PreferredManifestType
if options.Author != "" {
importBuilder.SetMaintainer(options.Author)
}
Expand Down

0 comments on commit 1fa27ff

Please sign in to comment.