Module Name: src
Committed By: yamt
Date: Wed Nov 2 16:43:04 UTC 2011
Modified Files:
src/lib/libpuffs: callcontext.c
Log Message:
puffs_cc_yield: fix a cc leak. PR/44679
To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/lib/libpuffs/callcontext.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/lib/libpuffs/callcontext.c
diff -u src/lib/libpuffs/callcontext.c:1.25 src/lib/libpuffs/callcontext.c:1.26
--- src/lib/libpuffs/callcontext.c:1.25 Fri Mar 4 09:47:47 2011
+++ src/lib/libpuffs/callcontext.c Wed Nov 2 16:43:04 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: callcontext.c,v 1.25 2011/03/04 09:47:47 yamt Exp $ */
+/* $NetBSD: callcontext.c,v 1.26 2011/11/02 16:43:04 yamt Exp $ */
/*
* Copyright (c) 2006, 2007, 2008 Antti Kantee. All Rights Reserved.
@@ -30,7 +30,7 @@
#include <sys/cdefs.h>
#if !defined(lint)
-__RCSID("$NetBSD: callcontext.c,v 1.25 2011/03/04 09:47:47 yamt Exp $");
+__RCSID("$NetBSD: callcontext.c,v 1.26 2011/11/02 16:43:04 yamt Exp $");
#endif /* !lint */
#include <sys/types.h>
@@ -78,6 +78,14 @@ puffs_cc_yield(struct puffs_cc *pcc)
assert(puffs_fakecc == 0);
+ if ((~pcc->pcc_flags & (PCC_BORROWED|PCC_DONE)) == 0) {
+ pcc->pcc_flags &= ~(PCC_BORROWED|PCC_DONE);
+ /*
+ * see the XXX comment in puffs__cc_cont
+ */
+ puffs__cc_destroy(pcc, 1);
+ setcontext(&pcc->pcc_uc_ret);
+ }
pcc->pcc_flags &= ~PCC_BORROWED;
/* romanes eunt domus */