[ovs-dev] [coverity 07/14] daemon: Fix leak of string in make_pidfile().

Justin Pettit jpettit at nicira.com
Tue Feb 22 01:44:50 UTC 2011


Coverity #10724
---
 lib/daemon.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lib/daemon.c b/lib/daemon.c
index a8b3fae..2f6f081 100644
--- a/lib/daemon.c
+++ b/lib/daemon.c
@@ -223,11 +223,11 @@ make_pidfile(void)
                                      pidfile, strerror(errno));
                         }
                     }
-                    free(text);
                 } else {
                     VLOG_ERR("%s: write failed: %s", tmpfile, strerror(errno));
                     close(fd);
                 }
+                free(text);
             } else {
                 VLOG_ERR("%s: fcntl failed: %s", tmpfile, strerror(errno));
                 close(fd);
-- 
1.7.1





More information about the dev mailing list