dm: fix memory leakage risk in create_and_inject_vrtct

Reading native RTCT failure induces leakage of
 memory pointered by 'buf'.

Tracked-On: #6157
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
This commit is contained in:
Yonghua Huang 2021-06-07 15:12:41 +08:00 committed by wenlingz
parent cb59ac1cfe
commit 59635fb984

View File

@ -1198,6 +1198,7 @@ int create_and_inject_vrtct(struct vmctx *ctx)
rc = read(native_rtct_fd, buf, native_rtct_len);
if (rc < native_rtct_len) {
pr_err("Native RTCT is not fully read into buf!!!");
free(buf);
return -1;
}
close(native_rtct_fd);