aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoland Dreier <rolandd@cisco.com>2006-06-01 23:16:18 +0000
committerRoland Dreier <rolandd@cisco.com>2006-11-09 11:36:01 -0800
commita734c77fe7ca9e6d02a6ba870134d9bd5f6944dc (patch)
tree655f6d0d571f32edc3018fc1ce854aebeec482de
parent69860428696da413eebd785143b7c3c568918e0e (diff)
downloadlibibverbs-a734c77fe7ca9e6d02a6ba870134d9bd5f6944dc.tar.gz
Fix ibv_get_device_list() to really NULL-terminate the array
Signed-off-by: Roland Dreier <rolandd@cisco.com>
-rw-r--r--ChangeLog5
-rw-r--r--src/device.c2
2 files changed, 6 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index fe7c902..d52532a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2006-06-01 Roland Dreier <rdreier@cisco.com>
+
+ * src/device.c (ibv_get_device_list): Actually return a
+ NULL-terminated array as the documentation promises.
+
2006-05-31 Roland Dreier <rdreier@cisco.com>
* src/init.c (find_drivers): Fix memory leak: the result of
diff --git a/src/device.c b/src/device.c
index a3a0394..8bdbb1e 100644
--- a/src/device.c
+++ b/src/device.c
@@ -64,7 +64,7 @@ struct ibv_device **ibv_get_device_list(int *num)
if (!num_devices)
num_devices = ibverbs_init(&device_list);
- l = calloc(num_devices, sizeof (struct ibv_device *));
+ l = calloc(num_devices + 1, sizeof (struct ibv_device *));
for (i = 0; i < num_devices; ++i)
l[i] = device_list[i];