]> git.openfabrics.org - ~shefty/librdmacm.git/commitdiff
librdmacm: Fix duplicate free of connect
authorSean Hefty <sean.hefty@intel.com>
Tue, 27 Sep 2011 18:19:36 +0000 (11:19 -0700)
committerSean Hefty <sean.hefty@intel.com>
Tue, 27 Sep 2011 18:19:36 +0000 (11:19 -0700)
The connect data stored with the cma_id_private is freed in
rdma_connect, since it is no longer needed.  Avoid duplicating
the free in rdma_destroy_id by checking for connect_len = 0,
rather than connect to be NULL.

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
src/cma.c

index 91e110e17b1c08086fe297e2e402b419e76e6cf7..e09ab99ae0d5a661a2b20a7047e3c057d251fdf7 100755 (executable)
--- a/src/cma.c
+++ b/src/cma.c
@@ -379,7 +379,7 @@ static void ucma_free_id(struct cma_id_private *id_priv)
 
        if (id_priv->sync)
                rdma_destroy_event_channel(id_priv->id.channel);
-       if (id_priv->connect)
+       if (id_priv->connect_len)
                free(id_priv->connect);
        free(id_priv);
 }
@@ -1319,7 +1319,7 @@ int rdma_connect(struct rdma_cm_id *id, struct rdma_conn_param *conn_param)
        if (ret != sizeof cmd)
                return (ret >= 0) ? ERR(ENODATA) : -1;
 
-       if (id_priv->connect) {
+       if (id_priv->connect_len) {
                free(id_priv->connect);
                id_priv->connect_len = 0;
        }