mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-09 13:57:27 +03:00
tests: Coverity found new NULL_RETURNS
Coverity reported the existing missing check of the return value and subsequent use from a call to virJSONValueFromString() in testJSONAddRemove().
This commit is contained in:
parent
a320730a88
commit
3b4b121423
@ -60,11 +60,17 @@ testJSONAddRemove(const void *data)
|
|||||||
{
|
{
|
||||||
const struct testInfo *info = data;
|
const struct testInfo *info = data;
|
||||||
virJSONValuePtr json;
|
virJSONValuePtr json;
|
||||||
virJSONValuePtr name;
|
virJSONValuePtr name = NULL;
|
||||||
char *result = NULL;
|
char *result = NULL;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
json = virJSONValueFromString(info->doc);
|
json = virJSONValueFromString(info->doc);
|
||||||
|
if (!json) {
|
||||||
|
if (virTestGetVerbose())
|
||||||
|
fprintf(stderr, "Fail to parse %s\n", info->doc);
|
||||||
|
ret = -1;
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
switch (virJSONValueObjectRemoveKey(json, "name", &name)) {
|
switch (virJSONValueObjectRemoveKey(json, "name", &name)) {
|
||||||
case 1:
|
case 1:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user