daemon: Fix leak of string in make_pidfile().
authorJustin Pettit <jpettit@nicira.com>
Tue, 22 Feb 2011 00:27:22 +0000 (16:27 -0800)
committerJustin Pettit <jpettit@nicira.com>
Tue, 22 Feb 2011 17:36:57 +0000 (09:36 -0800)
Coverity #10724

lib/daemon.c

index a8b3fae3c6e2e5ae5505ed38077dd5b013010ca8..2f6f08192016c03827047a14f4cc1c0e0b917e4e 100644 (file)
@@ -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);