vl.c: Exit QEMU early if no machine is found
authorDunrong Huang <riegamaths@gmail.com>
Mon, 23 Jul 2012 16:42:20 +0000 (00:42 +0800)
committerStefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Fri, 10 Aug 2012 13:28:11 +0000 (14:28 +0100)
commitfb7c269ed694c103397c5fffbfcccd3e90aed23c
treedf70db387a83dbd0f44552d33eb67606c8404667
parent3d1d9652978ac5a32a0beb4bdf6065ca39440d89
vl.c: Exit QEMU early if no machine is found

We check whether the variable machine is NULL or not before accessing
it. If machine is NULL, exit QEMU with an error, this can avoids a
segfault error.

Markus Armbruster <armbru@redhat.com> adds that the segfault can be
reproduced as follows:

  $ qemu-system-xtensa -cpu help

Signed-off-by: Dunrong Huang <riegamaths@gmail.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
vl.c