[PATCH 2/3] fifo.c: Eliminate logically dead code (Coverity 1437635)

Joel Sherrill joel at rtems.org
Thu Mar 14 13:22:32 UTC 2019


---
 cpukit/libfs/src/pipe/fifo.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/cpukit/libfs/src/pipe/fifo.c b/cpukit/libfs/src/pipe/fifo.c
index 71d5f85..3275e5f 100644
--- a/cpukit/libfs/src/pipe/fifo.c
+++ b/cpukit/libfs/src/pipe/fifo.c
@@ -149,18 +149,15 @@ static int pipe_new(
   pipe = *pipep;
   if (pipe == NULL) {
     err = pipe_alloc(&pipe);
-    if (err)
-      goto out;
+    if (err) {
+      pipe_unlock();
+      return err;
+    }
   }
 
   PIPE_LOCK(pipe);
 
-  if (*pipep == NULL) {
-    if (err)
-      pipe_free(pipe);
-    else
-      *pipep = pipe;
-  }
+  *pipep = pipe;
 
 out:
   pipe_unlock();
-- 
1.8.3.1




More information about the devel mailing list