summaryrefslogtreecommitdiff
path: root/render/box_construct.c
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2011-10-03 21:04:54 +0000
committerMichael Drake <tlsa@netsurf-browser.org>2011-10-03 21:04:54 +0000
commit2c41d4b44eae435f780bc3ba81978019a06fcf3d (patch)
tree7004825e62bf568c53853d00bc52f71e475a2835 /render/box_construct.c
parent6366f25f0da45b79ff7afdeb36cf7457951c9b13 (diff)
downloadnetsurf-2c41d4b44eae435f780bc3ba81978019a06fcf3d.tar.gz
netsurf-2c41d4b44eae435f780bc3ba81978019a06fcf3d.tar.bz2
Add talloc destructor for object_params.
svn path=/trunk/netsurf/; revision=12937
Diffstat (limited to 'render/box_construct.c')
-rw-r--r--render/box_construct.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/render/box_construct.c b/render/box_construct.c
index ba642f1f2..144d8d80c 100644
--- a/render/box_construct.c
+++ b/render/box_construct.c
@@ -1344,6 +1344,24 @@ bool box_image(BOX_SPECIAL_PARAMS)
/**
+ * Destructor for object_params, for <object> elements
+ *
+ * \param b The object params being destroyed.
+ * \return 0 to allow talloc to continue destroying the tree.
+ */
+static int box_object_talloc_destructor(struct object_params *o)
+{
+ if (o->codebase != NULL)
+ nsurl_unref(o->codebase);
+ if (o->classid != NULL)
+ nsurl_unref(o->classid);
+ if (o->data != NULL)
+ nsurl_unref(o->data);
+
+ return 0;
+}
+
+/**
* Generic embedded object [13.3].
*/
@@ -1366,6 +1384,9 @@ bool box_object(BOX_SPECIAL_PARAMS)
params = talloc(content, struct object_params);
if (!params)
return false;
+
+ talloc_set_destructor(params, box_object_talloc_destructor);
+
params->data = 0;
params->type = 0;
params->codetype = 0;