From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 954 invoked by alias); 13 Nov 2007 23:09:42 -0000 Received: (qmail 946 invoked by uid 22791); 13 Nov 2007 23:09:41 -0000 X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.33.17) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 13 Nov 2007 23:09:39 +0000 Received: from zps37.corp.google.com (zps37.corp.google.com [172.25.146.37]) by smtp-out.google.com with ESMTP id lADN9STZ015604 for ; Tue, 13 Nov 2007 23:09:29 GMT Received: from ug-out-1314.google.com (ugfe2.prod.google.com [10.66.182.2]) by zps37.corp.google.com with ESMTP id lADN9RR4001954 for ; Tue, 13 Nov 2007 15:09:27 -0800 Received: by ug-out-1314.google.com with SMTP id e2so218594ugf for ; Tue, 13 Nov 2007 15:09:26 -0800 (PST) Received: by 10.67.20.3 with SMTP id x3mr1163087ugi.1194995366245; Tue, 13 Nov 2007 15:09:26 -0800 (PST) Received: by 10.67.21.14 with HTTP; Tue, 13 Nov 2007 15:09:26 -0800 (PST) Message-ID: Date: Wed, 14 Nov 2007 00:13:00 -0000 From: "Douglas Evans" To: gcc-patches@gcc.gnu.org Subject: RFA: fix to thinko in make-relative-prefix.c:make_relative_prefix_1 MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2007-11/txt/msg00759.txt.bz2 Simple thinko. Return of NULL from strdup isn't checked. Ok to check in? 2007-11-13 Doug Evans * make-relative-prefix.c (make_relative_prefix_1): Handle NULL return from strdup. Index: make-relative-prefix.c =================================================================== *** make-relative-prefix.c (revision 130159) --- make-relative-prefix.c (working copy) *************** make_relative_prefix_1 (const char *prog *** 292,305 **** } } ! if ( resolve_links ) ! { ! full_progname = lrealpath (progname); ! if (full_progname == NULL) ! return NULL; ! } else ! full_progname = strdup(progname); prog_dirs = split_directories (full_progname, &prog_num); free (full_progname); --- 292,303 ---- } } ! if (resolve_links) ! full_progname = lrealpath (progname); else ! full_progname = strdup (progname); ! if (full_progname == NULL) ! return NULL; prog_dirs = split_directories (full_progname, &prog_num); free (full_progname);