[ofa-general] [PATCH] libibverbs/examples: free invalid pointer
Eli Cohen
eli at mellanox.co.il
Thu May 31 05:29:54 PDT 2007
the dev_list pointer is allocated, incremented and then freed.
Signed-off-by: Eli Cohen <eli at mellanox.co.il>
---
Index: libibverbs/examples/srq_pingpong.c
===================================================================
--- libibverbs.orig/examples/srq_pingpong.c 2007-05-31 15:18:10.000000000 +0300
+++ libibverbs/examples/srq_pingpong.c 2007-05-31 15:21:47.000000000 +0300
@@ -549,7 +549,7 @@ static void usage(const char *argv0)
int main(int argc, char *argv[])
{
- struct ibv_device **dev_list;
+ struct ibv_device **dev_list, **__dev_list;
struct ibv_device *ib_dev;
struct ibv_wc *wc;
struct pingpong_context *ctx;
@@ -668,7 +668,7 @@ int main(int argc, char *argv[])
page_size = sysconf(_SC_PAGESIZE);
- dev_list = ibv_get_device_list(NULL);
+ dev_list = __dev_list = ibv_get_device_list(NULL);
if (!dev_list) {
fprintf(stderr, "No IB devices found\n");
return 1;
@@ -863,7 +863,7 @@ int main(int argc, char *argv[])
if (pp_close_ctx(ctx, num_qp))
return 1;
- ibv_free_device_list(dev_list);
+ ibv_free_device_list(__dev_list);
free(rem_dest);
return 0;
More information about the general
mailing list