Fix memory leak in make_pidfile().
authorBen Pfaff <blp@nicira.com>
Fri, 9 Jan 2009 00:10:15 +0000 (16:10 -0800)
committerBen Pfaff <blp@nicira.com>
Fri, 9 Jan 2009 00:10:15 +0000 (16:10 -0800)
Found by Chris Eagle via Fortify.

lib/daemon.c

index b8fc5afe5be524a4656906a0a9e0c6ce5b7a0aaf..3f417d420ddae5e257658157080754ff74774ff4 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008 The Board of Trustees of The Leland Stanford
+/* Copyright (c) 2008, 2009 The Board of Trustees of The Leland Stanford
  * Junior University
  *
  * We are making the OpenFlow specification and associated documentation
@@ -178,6 +178,7 @@ make_pidfile(void)
                     } else {
                         /* Keep 'fd' open to retain the lock. */
                     }
+                    free(text);
                 } else {
                     VLOG_ERR("%s: write failed: %s", tmpfile, strerror(errno));
                     close(fd);