]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Fix minor memory leak in get_cwd()
authorJoel Rosdahl <joel@rosdahl.net>
Wed, 4 May 2011 20:34:12 +0000 (22:34 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Wed, 4 May 2011 20:34:12 +0000 (22:34 +0200)
Found and suggested by Bo Rydberg.

util.c

diff --git a/util.c b/util.c
index e534671485b51f6f5877dac8f512dadbf19a7041..d68d8c558a964c077f23ab4fe3ba330d11dd7670 100644 (file)
--- a/util.c
+++ b/util.c
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2002 Andrew Tridgell
- * Copyright (C) 2009-2010 Joel Rosdahl
+ * Copyright (C) 2009-2011 Joel Rosdahl
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License as published by the Free
@@ -932,6 +932,7 @@ get_cwd(void)
                return cwd;
        }
        if (st_pwd.st_dev == st_cwd.st_dev && st_pwd.st_ino == st_cwd.st_ino) {
+               free(cwd);
                return x_strdup(pwd);
        } else {
                return cwd;