]> git.openfabrics.org - ~shefty/libibverbs.git/commitdiff
Fix ibv_get_device_list() to really NULL-terminate the array
authorRoland Dreier <rolandd@cisco.com>
Thu, 1 Jun 2006 23:16:18 +0000 (23:16 +0000)
committerRoland Dreier <rolandd@cisco.com>
Thu, 9 Nov 2006 19:36:33 +0000 (11:36 -0800)
Signed-off-by: Roland Dreier <rolandd@cisco.com>
ChangeLog
src/device.c

index 41790e28b7509f09f3f3416f82a6162f80278a31..62780319fdf26ae9abe2bc7a3daff9e394b11fe4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,13 @@
+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), src/device.c (ibv_open_device): Fix
-       memleaks: the result of asprintf() needs to be freed when we're
-       done with it.
+       memory leaks: the result of asprintf() needs to be freed when
+       we're done with it.
 
        * examples/asyncwatch.c (event_name_str): Print human-readable
        form of IBV_EVENT_CLIENT_REREGISTER.
index 4eee31c77d564826111a2ba457ae86f0cee2ff2e..4ceb6400cd140141a98a9c1ba952182acc46998b 100644 (file)
@@ -63,7 +63,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];