mirror of https://gitee.com/openkylin/libvirt.git
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: Julio Faracco <jcfaracco@gmail.com> Reviewed-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
parent
8f0f8425d7
commit
879fde3272
|
@ -867,9 +867,13 @@ static int lxcContainerSetReadOnly(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mounts)
|
if (!mounts) {
|
||||||
qsort(mounts, nmounts, sizeof(mounts[0]),
|
ret = 0;
|
||||||
virStringSortRevCompare);
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
|
qsort(mounts, nmounts, sizeof(mounts[0]),
|
||||||
|
virStringSortRevCompare);
|
||||||
|
|
||||||
for (i = 0; i < nmounts; i++) {
|
for (i = 0; i < nmounts; i++) {
|
||||||
VIR_DEBUG("Bind readonly %s", mounts[i]);
|
VIR_DEBUG("Bind readonly %s", mounts[i]);
|
||||||
|
@ -883,9 +887,7 @@ static int lxcContainerSetReadOnly(void)
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
cleanup:
|
cleanup:
|
||||||
for (i = 0; i < nmounts; i++)
|
virStringListFreeCount(mounts, nmounts);
|
||||||
VIR_FREE(mounts[i]);
|
|
||||||
VIR_FREE(mounts);
|
|
||||||
endmntent(procmnt);
|
endmntent(procmnt);
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue