summaryrefslogtreecommitdiffstats
path: root/bin/sh/expand.c
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2014-03-26 20:43:40 +0000
committerjilles <jilles@FreeBSD.org>2014-03-26 20:43:40 +0000
commit270892ce0aa34981474cedfa90e120b5971c6e13 (patch)
treefbddad8551c3a2e6b6992b43332553c88006070a /bin/sh/expand.c
parent6ceec4444ddbcea29246cb67b83eff062485cdc3 (diff)
downloadFreeBSD-src-270892ce0aa34981474cedfa90e120b5971c6e13.zip
FreeBSD-src-270892ce0aa34981474cedfa90e120b5971c6e13.tar.gz
sh: Fix possible memory leaks and double frees with unexpected SIGINT.
Diffstat (limited to 'bin/sh/expand.c')
-rw-r--r--bin/sh/expand.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/bin/sh/expand.c b/bin/sh/expand.c
index 6c8b023..a126ca6 100644
--- a/bin/sh/expand.c
+++ b/bin/sh/expand.c
@@ -956,6 +956,7 @@ recordregion(int start, int end, int inquotes)
{
struct ifsregion *ifsp;
+ INTOFF;
if (ifslastp == NULL) {
ifsp = &ifsfirst;
} else {
@@ -963,6 +964,7 @@ recordregion(int start, int end, int inquotes)
&& ifslastp->inquotes == inquotes) {
/* extend previous area */
ifslastp->endoff = end;
+ INTON;
return;
}
ifsp = (struct ifsregion *)ckmalloc(sizeof (struct ifsregion));
@@ -973,6 +975,7 @@ recordregion(int start, int end, int inquotes)
ifslastp->begoff = start;
ifslastp->endoff = end;
ifslastp->inquotes = inquotes;
+ INTON;
}
OpenPOWER on IntegriCloud