merge from gcc
authorDJ Delorie <dj@redhat.com>
Mon, 24 Mar 2008 18:06:37 +0000 (18:06 +0000)
committerDJ Delorie <dj@redhat.com>
Mon, 24 Mar 2008 18:06:37 +0000 (18:06 +0000)
libiberty/ChangeLog
libiberty/make-relative-prefix.c

index fad27c3141406ad3fccb6b68b2e31b23a8963448..547007a5238ed33ee33f6a72fe95e55cc75365c1 100644 (file)
@@ -1,3 +1,8 @@
+2008-03-24  Doug Evans  <dje@google.com>
+
+       * make-relative-prefix.c (make_relative_prefix_1): Handle NULL
+       return from strdup.
+
 2008-03-12  Seongbae Park <seongbae.park@gmail.com>
 
        * cplus-dem.c (malloc, realloc): Use void * instead of char *
index 80e7f92fb418297bec8c14ca22f5cdcb09789a61..c98d287d7c08f15779cc51b8230c66bf3e85c7a6 100644 (file)
@@ -292,14 +292,12 @@ make_relative_prefix_1 (const char *progname, const char *bin_prefix,
        }
     }
 
-  if ( resolve_links )
-    {
-      full_progname = lrealpath (progname);
-      if (full_progname == NULL)
-       return NULL;
-    }
+  if (resolve_links)
+    full_progname = lrealpath (progname);
   else
-    full_progname = strdup(progname);
+    full_progname = strdup (progname);
+  if (full_progname == NULL)
+    return NULL;
 
   prog_dirs = split_directories (full_progname, &prog_num);
   free (full_progname);