diff --git a/ChangeLog b/ChangeLog
index 65a4411e28f0bf87eef4d565a6eef9525ed42e3f..dc46d976287692e7fca8c0fefc7b42c798899279 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,8 @@
 2016-02-10  Benno Schulenberg  <bensberg@justemail.net>
 	* src/text.c (discard_until): Prevent a chain of editing actions from
 	continuing after a discard.  This fixes Savannah bug #47104.
+	* src/files.c (get_full_path): Plug a sneaky memory leak.  This fixes
+	Savannah bug #47003 reported and solved by Mike Frysinger.
 
 2016-02-09  Benno Schulenberg  <bensberg@justemail.net>
 	* src/files.c (stat_with_alloc, open_buffer, write_file): Check the
diff --git a/src/files.c b/src/files.c
index 52ec63495f7d6d90bf9ce37d5ddb7f586e2694dc..e68e81c13e31a3ee14e074035de52584476e47f1 100644
--- a/src/files.c
+++ b/src/files.c
@@ -1504,10 +1504,10 @@ char *get_full_path(const char *origpath)
 	     * where we were before.  We don't check for a chdir()
 	     * error, since we can do nothing if we get one. */
 	    IGNORE_CALL_RESULT(chdir(d_here));
-
-	    /* Free d_here, since we're done using it. */
-	    free(d_here);
 	}
+
+	/* Free d_here, since we're done using it. */
+	free(d_here);
     }
 
     /* At this point, if path_only is FALSE and d_there isn't NULL,