提交 f01ee2ac 编写于 作者: M Matthias Bolte

qemu: Fix a memory leak in qemudExtractTTYPath

qemudWaitForMonitor calls qemudReadLogOutput with qemudFindCharDevicePTYs
as callback. qemudFindCharDevicePTYs calls qemudExtractTTYPath to assign
a string to chr->data.file.path. Afterwards qemudWaitForMonitor may call
qemudFindCharDevicePTYsMonitor that overwrites chr->data.file.path without
freeing the old value. This results in leaking the memory allocated by
qemudExtractTTYPath.

Report an OOM error if the strdup in qemudFindCharDevicePTYsMonitor fails.
上级 4c81b0fd
......@@ -1433,7 +1433,13 @@ qemudFindCharDevicePTYsMonitor(virConnectPtr conn,
return -1; \
} \
\
VIR_FREE(chr->data.file.path); \
chr->data.file.path = strdup(path); \
\
if (chr->data.file.path == NULL) { \
virReportOOMError(conn); \
return -1; \
} \
} \
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册