提交 879fde32 编写于 作者: J Julio Faracco 提交者: John Ferlan

lxc: Clang is complaining about possible NULL pointer.

The array "mount" inside lxc_container is not being checked before for
loop. Clang syntax scan is complaining about this segmentation fault.
Signed-off-by: NJulio Faracco <jcfaracco@gmail.com>
Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
上级 8f0f8425
......@@ -867,9 +867,13 @@ static int lxcContainerSetReadOnly(void)
}
}
if (mounts)
qsort(mounts, nmounts, sizeof(mounts[0]),
virStringSortRevCompare);
if (!mounts) {
ret = 0;
goto cleanup;
}
qsort(mounts, nmounts, sizeof(mounts[0]),
virStringSortRevCompare);
for (i = 0; i < nmounts; i++) {
VIR_DEBUG("Bind readonly %s", mounts[i]);
......@@ -883,9 +887,7 @@ static int lxcContainerSetReadOnly(void)
ret = 0;
cleanup:
for (i = 0; i < nmounts; i++)
VIR_FREE(mounts[i]);
VIR_FREE(mounts);
virStringListFreeCount(mounts, nmounts);
endmntent(procmnt);
return ret;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册