A buffer allocated in llapi_ladvise() for ioctl() is never
released. This patch ensures the buffer is properly freed.
Fixes:
e14246641c04 ("LU-4931 ladvise: Add feature of giving file access advices")
Signed-off-by: Jean-Yves VET <jyvet@ddn.com>
Change-Id: I0761e161074ae3029218473ec951670fdbbd33bd
Reviewed-on: https://review.whamcloud.com/39610
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Li Xi <lixi@ddn.com>
Reviewed-by: Jian Yu <yujian@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
rc = ioctl(fd, LL_IOC_LADVISE, ladvise_hdr);
if (rc < 0) {
llapi_error(LLAPI_MSG_ERROR, -errno, "cannot give advice");
- return -1;
+ goto out;
+ } else {
+ rc = 0;
}
/* Copy results back in to caller provided structs */
ladvise_iter->lla_lockahead_result;
}
- return 0;
+out:
+ free(ladvise_hdr);
+ return rc;
}