diff --git a/apps/app_ices.c b/apps/app_ices.c
index 195607ab6ef00960ed85e7b85595341307018461..67b107e415e6ed9a4c5a56110c6dca21b991dd9d 100644
--- a/apps/app_ices.c
+++ b/apps/app_ices.c
@@ -173,6 +173,7 @@ static int ices_exec(struct ast_channel *chan, void *data)
 					if (errno != EAGAIN) {
 						ast_log(LOG_WARNING, "Write failed to pipe: %s\n", strerror(errno));
 						res = -1;
+						ast_frfree(f);
 						break;
 					}
 				}