file cache: proactively free invalid cached contents

Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
1 files changed, 8 insertions(+), 0 deletions(-)

M file_cache.c
M file_cache.c +8 -0
@@ 127,6 127,14 @@ static void process_file(struct file_nod
 		 */
 		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 */