Received: from eggs.gnu.org ([2001:4830:134:3::10]:33950) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WYSeo-00037C-Dq for qemu-devel@nongnu.org; Fri, 11 Apr 2014 00:01:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WYSej-0004wp-5H for qemu-devel@nongnu.org; Fri, 11 Apr 2014 00:01:38 -0400 Received: from [59.151.112.132] (port=34340 helo=heian.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WYSei-0004lz-R5 for qemu-devel@nongnu.org; Fri, 11 Apr 2014 00:01:33 -0400 Received: from G08CNEXCHPEKD01.g08.fujitsu.local (localhost.localdomain [127.0.0.1]) by edo.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id s3B40tDD031579 for ; Fri, 11 Apr 2014 12:00:55 +0800 From: Hu Tao Date: Fri, 11 Apr 2014 11:59:14 +0800 Message-ID: <1397188754-10741-1-git-send-email-hutao@cn.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain Subject: [Qemu-devel] [PATCH] exit qemu when unknown object type is specified by -object List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org ...to avoid assertion failure in object_new_with_type(). Can be reproduced by: qemu -object unknown-object,id=xxx Signed-off-by: Hu Tao --- qom/object.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/qom/object.c b/qom/object.c index f4de619..1e7445b 100644 --- a/qom/object.c +++ b/qom/object.c @@ -448,6 +448,11 @@ Object *object_new(const char *typename) { TypeImpl *ti = type_get_by_name(typename); + if (!ti) { + error_report("unknown object type: %s\n", typename); + exit(1); + } + return object_new_with_type(ti); } -- 1.8.5.2.229.g4448466