A continuation of HomeBox the inventory and organization system built for the Home User
fix: #1249 invalid memory issue
Matthew Kilgore6a701af0b9a9
diff --git a/backend/app/api/handlers/v1/v1_ctrl_product_search.go b/backend/app/api/handlers/v1/v1_ctrl_product_search.goindex 248cf87e..10c180a5 100644--- a/backend/app/api/handlers/v1/v1_ctrl_product_search.go+++ b/backend/app/api/handlers/v1/v1_ctrl_product_search.go@@ -273,9 +273,13 @@ func (ctrl *V1Controller) HandleProductSearchFromBarcode(conf config.BarcodeAPICres, err := client.Get(p.ImageURL)if err != nil {log.Warn().Msg("Cannot fetch image for URL: " + p.ImageURL + ": " + err.Error())+ // On error, res may be nil; skip to next product to avoid nil dereference+ continue}+ // Ensure body is closed for successful responsesdefer func() {+ // res is non-nil here; merge any close errorerr = errors.Join(err, res.Body.Close())}()