xend_internal.c: don't dereference NULL for unexpected input

* src/xen/xend_internal.c (xenDaemonDomainSetAutostart): Avoid a NULL
dereference upon non-SEXPR_VALUE'd on_xend_start.  This bug was
introduced by commit 37ce5600c0.
This commit is contained in:
Jim Meyering 2010-02-19 17:45:41 +01:00
parent 6ef20bb7ae
commit 14ee6a66f8

View File

@ -4411,7 +4411,7 @@ xenDaemonDomainSetAutostart(virDomainPtr domain,
if (autonode) {
const char *val = (autonode->u.s.car->kind == SEXPR_VALUE
? autonode->u.s.car->u.value : NULL);
if (!STREQ(val, "ignore") && !STREQ(val, "start")) {
if (!val || (!STREQ(val, "ignore") && !STREQ(val, "start"))) {
virXendError(domain->conn, VIR_ERR_INTERNAL_ERROR,
"%s", _("unexpected value from on_xend_start"));
goto error;