Dr. Werner Fink 2010-02-24 08:56:36 +00:00 committed by Git OBS Bridge
parent a5c9f9b538
commit 7b7d083237
2 changed files with 30 additions and 1 deletions

View File

@ -15,7 +15,7 @@
#if 0 #if 0
--- xmalloc.c --- xmalloc.c
+++ xmalloc.c 2010-02-15 15:36:40.113797875 +0000 +++ xmalloc.c 2010-02-24 08:32:51.452626384 +0000
@@ -35,6 +35,11 @@ @@ -35,6 +35,11 @@
# include "ansi_stdlib.h" # include "ansi_stdlib.h"
#endif /* HAVE_STDLIB_H */ #endif /* HAVE_STDLIB_H */
@ -121,3 +121,27 @@
if (temp == 0) if (temp == 0)
allocerr ("xrealloc", bytes); allocerr ("xrealloc", bytes);
@@ -145,7 +204,22 @@ xfree (string)
PTR_T string;
{
if (string)
- free (string);
+ {
+ sigset_t set, oset;
+ int blocked_sigs = 0;
+
+ /* Block all signals in case we are executed from a signal handler. */
+ if (interrupt_immediately || signal_is_trapped (SIGINT) || signal_is_trapped (SIGCHLD))
+ {
+ block_signals (&set, &oset);
+ blocked_sigs = 1;
+ }
+
+ free (string);
+
+ if (blocked_sigs)
+ unblock_signals (&set, &oset);
+ }
}
#ifdef USING_BASH_MALLOC

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Wed Feb 24 09:55:03 CET 2010 - werner@suse.de
- Avoid hang due malloc()/free() within signal handler (bnc#522351)
------------------------------------------------------------------- -------------------------------------------------------------------
Thu Feb 18 11:05:13 CET 2010 - werner@suse.de Thu Feb 18 11:05:13 CET 2010 - werner@suse.de