Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 18eaf1f1 authored by Roland Dreier's avatar Roland Dreier Committed by Doug Ledford
Browse files

RDMA/ocrdma: Fix memory leak in _ocrdma_alloc_pd()



If ocrdma_get_pd_num() fails, then we need to free the pd struct we allocated.

This was detected by Coverity (CID 1271245).

Signed-off-by: default avatarRoland Dreier <roland@purestorage.com>
Acked-By: default avatarDevesh Sharma <devesh.sharma@avagotech.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent d655a9fb
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -375,7 +375,12 @@ static struct ocrdma_pd *_ocrdma_alloc_pd(struct ocrdma_dev *dev,

	if (dev->pd_mgr->pd_prealloc_valid) {
		status = ocrdma_get_pd_num(dev, pd);
		return (status == 0) ? pd : ERR_PTR(status);
		if (status == 0) {
			return pd;
		} else {
			kfree(pd);
			return ERR_PTR(status);
		}
	}

retry: