* archive.cc (Archive::include_member): Unlock an external member
authorIan Lance Taylor <ian@airs.com>
Tue, 13 Jul 2010 07:56:08 +0000 (07:56 +0000)
committerIan Lance Taylor <ian@airs.com>
Tue, 13 Jul 2010 07:56:08 +0000 (07:56 +0000)
of a thin archive.  Don't bother to delete an object we know is
NULL.

gold/ChangeLog
gold/archive.cc

index 14c5386dc05d8691fb4ca47175363e02239b8927..d62547ef2bb7f4324cf9f66899a4dcba61ef9cbf 100644 (file)
@@ -1,3 +1,9 @@
+2010-07-13  Ian Lance Taylor  <iant@google.com>
+
+       * archive.cc (Archive::include_member): Unlock an external member
+       of a thin archive.  Don't bother to delete an object we know is
+       NULL.
+
 2010-07-12  Cary Coutant  <ccoutant@google.com>
 
        * compressed_output.cc (zlib_decompress): New function.
index 36e4862871e28e105b27b4eca97d1ddb0e03490a..202fc2c8eb3afd4f1f468e8aca5f469bce10520a 100644 (file)
@@ -853,11 +853,7 @@ Archive::include_member(Symbol_table* symtab, Layout* layout,
       && this->searched_for()
       && obj == NULL
       && unconfigured)
-    {
-      if (obj != NULL)
-       delete obj;
-      return false;
-    }
+    return false;
 
   if (obj == NULL)
     return true;
@@ -874,7 +870,13 @@ Archive::include_member(Symbol_table* symtab, Layout* layout,
     }
 
   if (!input_objects->add_object(obj))
-    delete obj;
+    {
+      // If this is an external member of a thin archive, unlock the
+      // file.
+      if (obj->offset() == 0)
+       obj->unlock(this->task_);
+      delete obj;
+    }
   else
     {
       {