diff options
author | Guy Harris <guy@alum.mit.edu> | 2019-11-27 11:56:51 -0800 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2019-11-27 11:56:51 -0800 |
commit | daa83500c5128404c76787996596306e97e6df91 (patch) | |
tree | ad6b388b052738d103a4ed90b1490ace89ca2655 /pcap-rdmasniff.c | |
parent | 3191c8b7bfd08088108e100411541a0a8b9ac936 (diff) |
Plug another memory leak.
Again, if ibv_get_device_list() returns a non-null pointer, and sets the
"number of devices" value to 0, we still have to free the list pointed
to by the non-null pointer.
Diffstat (limited to 'pcap-rdmasniff.c')
-rw-r--r-- | pcap-rdmasniff.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/pcap-rdmasniff.c b/pcap-rdmasniff.c index 9cb56abb..032b80f8 100644 --- a/pcap-rdmasniff.c +++ b/pcap-rdmasniff.c @@ -368,7 +368,11 @@ rdmasniff_create(const char *device, char *ebuf, int *is_ours) *is_ours = 0; dev_list = ibv_get_device_list(&numdev); - if (!dev_list || !numdev) { + if (!dev_list) { + return NULL; + } + if (!numdev) { + ibv_free_device_list(dev_list); return NULL; } |