This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RFA: fix to thinko in make-relative-prefix.c:make_relative_prefix_1


Simple thinko.  Return of NULL from strdup isn't checked.

Ok to check in?

2007-11-13  Doug Evans  <dje@google.com>

        * 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);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]