summaryrefslogtreecommitdiff
path: root/source4/lib/appweb/mpr
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-08-22 01:51:02 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:34:18 -0500
commit81556a90785c90f928690929c5735bc3ee9c8eca (patch)
treeffdd9e7643f262d05bf10006b0d1c2c922581a85 /source4/lib/appweb/mpr
parent86e796643e2993ef3e3fb8b88faecf1261f01f10 (diff)
downloadsamba-81556a90785c90f928690929c5735bc3ee9c8eca.tar.gz
samba-81556a90785c90f928690929c5735bc3ee9c8eca.tar.bz2
samba-81556a90785c90f928690929c5735bc3ee9c8eca.zip
r9464: fixed a problem with child pointers copied into non-allocated mpr variables. We
now use the same free technique as is used for mpr strings, rather than relying on being a child of the variable (This used to be commit 3d6739eaa6e1b56d67bc7d9b5350a6911c96597a)
Diffstat (limited to 'source4/lib/appweb/mpr')
-rw-r--r--source4/lib/appweb/mpr/var.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/source4/lib/appweb/mpr/var.c b/source4/lib/appweb/mpr/var.c
index 77f4cbc55a..09979156e8 100644
--- a/source4/lib/appweb/mpr/var.c
+++ b/source4/lib/appweb/mpr/var.c
@@ -181,6 +181,13 @@ static bool freeVarStorage(MprVar *vp, int force)
}
break;
+ case MPR_TYPE_PTR:
+ if (vp->allocatedData) {
+ vp->allocatedData = 0;
+ mprFree(vp->ptr);
+ }
+ break;
+
case MPR_TYPE_OBJECT:
#if VAR_DEBUG
/*
@@ -1418,7 +1425,12 @@ static void copyVarCore(MprVar *dest, MprVar *src, int copyDepth)
case MPR_TYPE_PTR:
/* we have to reference here so talloc structures survive a
copy */
- dest->ptr = talloc_reference(dest, src->ptr);
+ if (src->allocatedData) {
+ dest->ptr = talloc_reference(mprMemCtx(), src->ptr);
+ dest->allocatedData = 1;
+ } else {
+ dest->ptr = src->ptr;
+ }
break;
case MPR_TYPE_STRING_CFUNCTION: