From 9c8d629f2baf71f9ffe69012ca3f2c06deb10151 Mon Sep 17 00:00:00 2001 From: Angira Kekteeva Date: Wed, 16 Nov 2022 14:32:27 +0400 Subject: [PATCH] [#741] Fix data race Signed-off-by: Angira Kekteeva --- api/layer/object.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/api/layer/object.go b/api/layer/object.go index c5195a261..740bbb02b 100644 --- a/api/layer/object.go +++ b/api/layer/object.go @@ -406,7 +406,10 @@ func (n *layer) objectPutAndHash(ctx context.Context, prm PrmObjectCreate, bktIn hash.Write(buf) }) id, err := n.neoFS.CreateObject(ctx, prm) - return id, hash.Sum(nil), err + if err != nil { + return oid.ID{}, nil, err + } + return id, hash.Sum(nil), nil } // ListObjectsV1 returns objects in a bucket for requests of Version 1.