file cache: proactively free invalid cached contents v4.6
authorJosef 'Jeff' Sipek <jeffpc@josefsipek.net>
Wed, 14 Nov 2018 10:55:15 -0500
changeset 986 fab9a5469492
parent 985 67496ee6fb3d
child 987 3f0b82ff74b4
file cache: proactively free invalid cached contents Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
file_cache.c
--- a/file_cache.c	Wed Nov 14 10:38:09 2018 -0500
+++ b/file_cache.c	Wed Nov 14 10:55:15 2018 -0500
@@ -127,6 +127,14 @@
 		 */
 		if (events & FILE_EXCEPTION)
 			goto free;
+
+		/*
+		 * Because the cached data is invalid (and therefore
+		 * useless), we can free it now and avoid having it linger
+		 * around, ending up core files, etc.
+		 */
+		str_putref(node->contents);
+		node->contents = NULL;
 	}
 
 	/* re-register */