libibverbs: delete MR when unregistering
authorshefty <shefty@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Wed, 30 Sep 2009 22:33:27 +0000 (22:33 +0000)
committershefty <shefty@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Wed, 30 Sep 2009 22:33:27 +0000 (22:33 +0000)
Signed-off-by: Sean Hefty <sean.hefty@intel.com>
git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@2480 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

ulp/libibverbs/src/verbs.cpp

index e577733..849f8ae 100644 (file)
@@ -305,7 +305,13 @@ struct ibv_mr *ibv_reg_mr(struct ibv_pd *pd, void *addr,
 __declspec(dllexport)\r
 int ibv_dereg_mr(struct ibv_mr *mr)\r
 {\r
-       return mr->pd->handle->DeregisterMemory(mr->lkey, NULL);\r
+       HRESULT hr;\r
+\r
+       hr = mr->pd->handle->DeregisterMemory(mr->lkey, NULL);\r
+       if (SUCCEEDED(hr)) {\r
+               delete mr;\r
+       }\r
+       return hr;\r
 }\r
 \r
 __declspec(dllexport)\r