The result of asprintf needs to be free when no longer needed.
Signed-off-by: Roland Dreier <rolandd@cisco.com>
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.
+
* examples/asyncwatch.c (event_name_str): Print human-readable
form of IBV_EVENT_CLIENT_REREGISTER.
* provider needs to mmap() the file.
*/
cmd_fd = open(devpath, O_RDWR);
+ free(devpath);
+
if (cmd_fd < 0)
return NULL;
asprintf(&pat, "%s/*.so", dir);
ret = glob(pat, 0, NULL, &so_glob);
+ free(pat);
+
if (ret) {
if (ret != GLOB_NOMATCH)
fprintf(stderr, PFX "Warning: couldn't search %s\n", pat);