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>
}
}
- 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]);
ret = 0;
cleanup:
- for (i = 0; i < nmounts; i++)
- VIR_FREE(mounts[i]);
- VIR_FREE(mounts);
+ virStringListFreeCount(mounts, nmounts);
endmntent(procmnt);
return ret;