Skip to contentSkip to conversation

rev: Avoid calling free in a signal handler

PATCH Applied Tobias Stoeckmann 2 participants 2 messages Oct 3, 2016 – Oct 6, 2016 Util-Linux package

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rev: Avoid calling free in a signal handler

free() is not a safe function for a signal handler. The next line calls _exit() anyway, so there is no need for resource management.

---
 text-utils/rev.c | 1 -
 1 file changed, 1 deletion(-)
text-utils/rev.c +0 -1
index cb38482..ace2cd6 100644
@@ -68,7 +68,6 @@ wchar_t *buf;
 
 static void sig_handler(int signo __attribute__ ((__unused__)))
 {
-	free(buf);
 	_exit(EXIT_SUCCESS);
 }
 
Signature · 1 line
2.10.0
maintainer Applied
#1 lore raw
Quoted 6 lines · Tobias Stoeckmann

free() is not a safe function for a signal handler. The next line calls _exit() anyway, so there is no need for resource management.

---
 text-utils/rev.c | 1 -
 1 file changed, 1 deletion(-)

Applied, thanks.

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com