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,8 +1959,10 @@ virConfPtr xenFormatXM(virConnectPtr conn,
break;
}
}
if (xenFormatXMSerial(serialVal, chr) < 0)
if (xenFormatXMSerial(serialVal, chr) < 0) {
virConfFreeValue(serialVal);
goto cleanup;
}
}
if (serialVal->list != NULL) {