Fix leak of serial value in xenFormatXM on OOM

If an OOM occurs in xenFormatXM when formatting to the
serial device value, the value is leaked.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrange 2013-09-24 16:46:44 +01:00
parent 760b59e909
commit 0377238fe8

View File

@ -1959,9 +1959,11 @@ virConfPtr xenFormatXM(virConnectPtr conn,
break; break;
} }
} }
if (xenFormatXMSerial(serialVal, chr) < 0) if (xenFormatXMSerial(serialVal, chr) < 0) {
virConfFreeValue(serialVal);
goto cleanup; goto cleanup;
} }
}
if (serialVal->list != NULL) { if (serialVal->list != NULL) {
int ret = virConfSetValue(conf, "serial", serialVal); int ret = virConfSetValue(conf, "serial", serialVal);