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 154fe59531
commit 067cf8aa2c

View File

@ -1199,6 +1199,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);