From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27414 invoked by alias); 13 Aug 2007 22:43:04 -0000 Received: (qmail 27148 invoked by uid 22791); 13 Aug 2007 22:42:55 -0000 X-Spam-Check-By: sourceware.org Received: from a.mail.sonic.net (HELO a.mail.sonic.net) (64.142.16.245) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 13 Aug 2007 22:42:53 +0000 Received: from webmail.sonic.net (b.webmail.sonic.net [64.142.100.148]) by a.mail.sonic.net (8.13.8.Beta0-Sonic/8.13.7) with ESMTP id l7DMghqH019183; Mon, 13 Aug 2007 15:42:43 -0700 Received: from 12.7.175.2 (SquirrelMail authenticated user msnyder) by webmail.sonic.net with HTTP; Mon, 13 Aug 2007 15:42:43 -0700 (PDT) Message-ID: <18292.12.7.175.2.1187044963.squirrel@webmail.sonic.net> Date: Mon, 13 Aug 2007 22:43:00 -0000 Subject: [PATCH] varobj.c (cplus_describe_child): guard null (resubmit) From: msnyder@sonic.net To: gdb-patches@sourceware.org Cc: ghost@cs.msu.su User-Agent: SquirrelMail/1.4.9a MIME-Version: 1.0 Content-Type: multipart/mixed;boundary="----=_20070813154243_67851" Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2007-08/txt/msg00264.txt.bz2 ------=_20070813154243_67851 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit Content-length: 101 Adapted from Vladimir's suggestion. The switch default allows the pointer to be null at this point. ------=_20070813154243_67851 Content-Type: text/plain; name="304b.txt" Content-Transfer-Encoding: 8bit Content-Disposition: attachment; filename="304b.txt" Content-length: 1557 2007-08-13 Michael Snyder * varobj.c (cplus_describe_child): Guard against null. Use "NULL" instead of "0" to initialize pointers. Index: varobj.c =================================================================== RCS file: /cvs/src/src/gdb/varobj.c,v retrieving revision 1.90 diff -p -r1.90 varobj.c *** varobj.c 8 Aug 2007 21:46:37 -0000 1.90 --- varobj.c 13 Aug 2007 22:37:46 -0000 *************** static void *** 2315,2321 **** cplus_describe_child (struct varobj *parent, int index, char **cname, struct value **cvalue, struct type **ctype) { ! char *name = 0; struct value *value; struct type *type; --- 2315,2321 ---- cplus_describe_child (struct varobj *parent, int index, char **cname, struct value **cvalue, struct type **ctype) { ! char *name = NULL; struct value *value; struct type *type; *************** cplus_describe_child (struct varobj *par *** 2396,2402 **** } else { ! char *access = 0; int children[3]; cplus_class_num_children (type, children); --- 2396,2402 ---- } else { ! char *access = NULL; int children[3]; cplus_class_num_children (type, children); *************** cplus_describe_child (struct varobj *par *** 2435,2441 **** /* error! */ break; } ! if (cname) *cname = xstrdup (access); --- 2435,2442 ---- /* error! */ break; } ! ! gdb_assert (access); if (cname) *cname = xstrdup (access); ------=_20070813154243_67851--