mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
xen: Check return value of virStringReplace
After 6604a3dd9f
in which new helper function has been
introduced, the code calls virStringReplace and dereference the
result immediately. The string function can, however, return NULL
so this would SIGSEGV right away. Check for the return value of
the string function.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
a0e5faaf66
commit
e0392f5a74
@ -254,7 +254,8 @@ xenParseXLDiskSrc(virDomainDiskDefPtr disk, char *srcstr)
|
|||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
if (STRPREFIX(srcstr, "rbd:")) {
|
if (STRPREFIX(srcstr, "rbd:")) {
|
||||||
tmpstr = virStringReplace(srcstr, "\\\\", "\\");
|
if (!(tmpstr = virStringReplace(srcstr, "\\\\", "\\")))
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
virDomainDiskSetType(disk, VIR_STORAGE_TYPE_NETWORK);
|
virDomainDiskSetType(disk, VIR_STORAGE_TYPE_NETWORK);
|
||||||
disk->src->protocol = VIR_STORAGE_NET_PROTOCOL_RBD;
|
disk->src->protocol = VIR_STORAGE_NET_PROTOCOL_RBD;
|
||||||
|
Loading…
Reference in New Issue
Block a user