提交 bb15ac45 编写于 作者: P Peter Krempa

qemu: block: Break out early on invalid storage sources

Return NULL right away in qemuBlockStorageSourceGetBackendProps when an
invalid storage source is presented so that virJSONValueObjectAdd isn't
called with a NULL argument.

Found by coverity.
上级 19448a25
...@@ -958,7 +958,7 @@ qemuBlockStorageSourceGetBackendProps(virStorageSourcePtr src) ...@@ -958,7 +958,7 @@ qemuBlockStorageSourceGetBackendProps(virStorageSourcePtr src)
case VIR_STORAGE_TYPE_VOLUME: case VIR_STORAGE_TYPE_VOLUME:
case VIR_STORAGE_TYPE_NONE: case VIR_STORAGE_TYPE_NONE:
case VIR_STORAGE_TYPE_LAST: case VIR_STORAGE_TYPE_LAST:
break; return NULL;
case VIR_STORAGE_TYPE_NETWORK: case VIR_STORAGE_TYPE_NETWORK:
switch ((virStorageNetProtocol) src->protocol) { switch ((virStorageNetProtocol) src->protocol) {
...@@ -1008,7 +1008,7 @@ qemuBlockStorageSourceGetBackendProps(virStorageSourcePtr src) ...@@ -1008,7 +1008,7 @@ qemuBlockStorageSourceGetBackendProps(virStorageSourcePtr src)
case VIR_STORAGE_NET_PROTOCOL_NONE: case VIR_STORAGE_NET_PROTOCOL_NONE:
case VIR_STORAGE_NET_PROTOCOL_LAST: case VIR_STORAGE_NET_PROTOCOL_LAST:
break; return NULL;
} }
break; break;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册