The function docs state that 'strcontent' may be NULL, but code added in
3506f1ecfde did not use the 'cmpcontent' variable which was fixed and
dereferenced it.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
tests/testutils.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/testutils.c b/tests/testutils.c
index 040ef1d2f7..4bd1b63755 100644
--- a/tests/testutils.c
+++ b/tests/testutils.c
@@ -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;
}
--
2.16.2