diff options
-rw-r--r-- | render/box_construct.c | 31 | ||||
-rw-r--r-- | riscos/plugin.c | 62 |
2 files changed, 42 insertions, 51 deletions
diff --git a/render/box_construct.c b/render/box_construct.c index 9e2bc7bf6..5773fe7c7 100644 --- a/render/box_construct.c +++ b/render/box_construct.c @@ -102,7 +102,7 @@ static bool box_frameset(BOX_SPECIAL_PARAMS); static bool box_select_add_option(struct form_control *control, xmlNode *n); static bool box_object(BOX_SPECIAL_PARAMS); static bool box_embed(BOX_SPECIAL_PARAMS); -static bool box_applet(BOX_SPECIAL_PARAMS); +/*static bool box_applet(BOX_SPECIAL_PARAMS);*/ static bool box_iframe(BOX_SPECIAL_PARAMS); static bool plugin_decode(struct content* content, struct box* box); static struct box_multi_length *box_parse_multi_lengths(const char *s, @@ -1162,8 +1162,8 @@ bool box_object(BOX_SPECIAL_PARAMS) box->object_params = po; /* start fetch */ - if (plugin_decode(content, box)) - return false; + if (!plugin_decode(content, box)) + *convert_children = true; return true; } @@ -2207,12 +2207,21 @@ bool plugin_decode(struct content *content, struct box *box) /* free pre-existing codebase */ if (po->codebase) - free(po->codebase); + talloc_free(po->codebase); + + po->codebase = talloc_strdup(content, codebase); + if (!po->codebase) { + free(codebase); + return false; + } - po->codebase = codebase; + /* no longer need this */ + free(codebase); /* Set basehref */ - po->basehref = strdup(content->data.html.base_url); + po->basehref = talloc_strdup(content, content->data.html.base_url); + if (!po->basehref) + return false; if (po->data == 0 && po->classid == 0) /* no data => ignore this object */ @@ -2242,8 +2251,14 @@ bool plugin_decode(struct content *content, struct box *box) return false; } if (po->codebase) - free(po->codebase); - po->codebase = codebase; + talloc_free(po->codebase); + po->codebase = talloc_strdup(content, + codebase); + free(codebase); + if (!po->codebase) { + free(url); + return false; + } } else { LOG(("ActiveX object")); diff --git a/riscos/plugin.c b/riscos/plugin.c index 828bc0c92..8ebe3d6d4 100644 --- a/riscos/plugin.c +++ b/riscos/plugin.c @@ -1076,7 +1076,7 @@ void plugin_destroy_stream(struct content *c) bool plugin_write_parameters_file(struct content *c, struct object_params *params) { - struct plugin_params *temp; + struct plugin_params *p; struct plugin_param_item *ppi; struct plugin_param_item *pilist = 0; char bgcolor[10] = {0}; @@ -1127,47 +1127,36 @@ bool plugin_write_parameters_file(struct content *c, } /* Iterate through the parameter list, creating the parameters - * file as we go. We can free up the memory as we go. + * file as we go. */ - while (params->params != 0) { - LOG(("name: %s", params->params->name == 0 ? "not set" : params->params->name)); - LOG(("value: %s", params->params->value == 0 ? "not set" : params->params->value)); - LOG(("type: %s", params->params->type == 0 ? "not set" : params->params->type)); - LOG(("valuetype: %s", params->params->valuetype)); + for (p = params->params; p != 0; p = p->next) { + LOG(("name: %s", p->name == 0 ? "not set" : p->name)); + LOG(("value: %s", p->value == 0 ? "not set" : p->value)); + LOG(("type: %s", p->type == 0 ? "not set" : p->type)); + LOG(("valuetype: %s", p->valuetype)); - if (strcasecmp(params->params->valuetype, "data") == 0) + if (strcasecmp(p->valuetype, "data") == 0) if (!plugin_add_item_to_pilist(&pilist, PLUGIN_PARAMETER_DATA, - (const char *)params->params->name, - (const char *)params->params->value, - (const char *)params->params->type)) + (const char *)p->name, + (const char *)p->value, + (const char *)p->type)) goto error; - if (strcasecmp(params->params->valuetype, "ref") == 0) + if (strcasecmp(p->valuetype, "ref") == 0) if (!plugin_add_item_to_pilist(&pilist, PLUGIN_PARAMETER_URL, - (const char *)params->params->name, - (const char *)params->params->value, - (const char *)params->params->type)) + (const char *)p->name, + (const char *)p->value, + (const char *)p->type)) goto error; - if (strcasecmp(params->params->valuetype, "object") == 0) + if (strcasecmp(p->valuetype, "object") == 0) if (!plugin_add_item_to_pilist(&pilist, PLUGIN_PARAMETER_OBJECT, - (const char *)params->params->name, - (const char *)params->params->value, - (const char *)params->params->type)) + (const char *)p->name, + (const char *)p->value, + (const char *)p->type)) goto error; - - temp = params->params; - params->params = params->params->next; - - free(temp->name); - free(temp->value); - free(temp->type); - free(temp->valuetype); - temp->name = temp->value = temp->type = temp->valuetype = 0; - free(temp); - temp = 0; } /* Now write mandatory special parameters */ @@ -1263,19 +1252,6 @@ error: ppi = 0; } - while (params->params) { - temp = params->params; - params->params = params->params->next; - - free(temp->name); - free(temp->value); - free(temp->type); - free(temp->valuetype); - temp->name = temp->value = temp->type = temp->valuetype = 0; - free(temp); - temp = 0; - } - free(c->data.plugin.filename); c->data.plugin.filename = 0; return false; |