diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 6c06cbc273..9d223392f2 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -706,17 +706,21 @@ static int testOpenVolumesForPool(xmlDocPtr xml, goto error; } - if (virAsprintf(&def->target.path, "%s/%s", - pool->def->target.path, - def->name) == -1) { - virReportOOMError(); - goto error; + if (def->target.path == NULL) { + if (virAsprintf(&def->target.path, "%s/%s", + pool->def->target.path, + def->name) == -1) { + virReportOOMError(); + goto error; + } } - def->key = strdup(def->target.path); if (def->key == NULL) { - virReportOOMError(); - goto error; + def->key = strdup(def->target.path); + if (def->key == NULL) { + virReportOOMError(); + goto error; + } } pool->def->allocation += def->allocation;