From 1fa27ffb62d0140c8b0af66c3dfda498f9b0103f Mon Sep 17 00:00:00 2001 From: Tigran Sogomonian Date: Thu, 28 Nov 2024 14:01:45 +0300 Subject: [PATCH] api: Error checking before NULL dereference 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 --- libpod/container_commit.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libpod/container_commit.go b/libpod/container_commit.go index 832b1499a1..642556995e 100644 --- a/libpod/container_commit.go +++ b/libpod/container_commit.go @@ -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) }