diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index 68f6f38592381cec8a96cf765896f8f1b892ab6e..5007a178e96d68c88c35a0428d659fea1e769379 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -1,3 +1,7 @@
+2006-03-24  Jim Blandy  <jimb@codesourcery.com>
+
+	* pex-common.c (pex_run): Simplify output name handling.
+
 2006-03-12  Jim Blandy  <jimb@red-bean.com>
 
 	* pex-common.h (struct pex_obj): Doc fixes.
diff --git a/libiberty/pex-common.c b/libiberty/pex-common.c
index b2ca6e08ce208151554088d44c7b103f5974e839..db842aed2439822c3e15b24f2c38cc445162784a 100644
--- a/libiberty/pex-common.c
+++ b/libiberty/pex-common.c
@@ -211,17 +211,10 @@ pex_run (struct pex_obj *obj, int flags, const char *executable,
 	  outname_allocated = 0;
 	}
 
-      if (!outname_allocated)
-	{
-	  obj->next_input_name = outname;
-	  obj->next_input_name_allocated = 0;
-	}
-      else
-	{
-	  obj->next_input_name = outname;
-	  outname_allocated = 0;
-	  obj->next_input_name_allocated = 1;
-	}
+      /* Hand off ownership of outname to the next stage.  */
+      obj->next_input_name = outname;
+      obj->next_input_name_allocated = outname_allocated;
+      outname_allocated = 0;
     }
   else
     {