提交 dff110d2 编写于 作者: P Peter Krempa

tests: utils: Tolerate NULL actual data in virTestCompareToFile

The function docs state that 'strcontent' may be NULL. This was added in
8b3a0b28 but that commit neglected to fix rest of the function.
Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
上级 452c2cc7
......@@ -800,8 +800,8 @@ virTestCompareToFile(const char *strcontent,
if (filecontentLen > 0 &&
filecontent[filecontentLen - 1] == '\n' &&
strcontent[strlen(strcontent) - 1] != '\n') {
if (virAsprintf(&fixedcontent, "%s\n", strcontent) < 0)
cmpcontent[strlen(cmpcontent) - 1] != '\n') {
if (virAsprintf(&fixedcontent, "%s\n", cmpcontent) < 0)
goto failure;
cmpcontent = fixedcontent;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册