From c76932f4c66e23ee8eab130f0b8c8901463d5d0f Mon Sep 17 00:00:00 2001 From: Tigran Sogomonian Date: Tue, 3 Dec 2024 14:07:58 +0300 Subject: [PATCH] api: replace inspectID with name If err != nil then inspect is nil thus here it is better to use name when outputting the error instead of inspectID. Found by Linux Verification Center (linuxtesting.org) with SVACE. Signed-off-by: Tigran Sogomonian --- pkg/api/handlers/libpod/images.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/api/handlers/libpod/images.go b/pkg/api/handlers/libpod/images.go index c5db3c7387..3a86121f7d 100644 --- a/pkg/api/handlers/libpod/images.go +++ b/pkg/api/handlers/libpod/images.go @@ -107,7 +107,7 @@ func GetImage(w http.ResponseWriter, r *http.Request) { options := &libimage.InspectOptions{WithParent: true, WithSize: true} inspect, err := newImage.Inspect(r.Context(), options) if err != nil { - utils.Error(w, http.StatusInternalServerError, fmt.Errorf("failed in inspect image %s: %w", inspect.ID, err)) + utils.Error(w, http.StatusInternalServerError, fmt.Errorf("failed in inspect image %s: %w", name, err)) return } utils.WriteResponse(w, http.StatusOK, inspect)