[project @ 2005-04-09 22:56:34 by jmb]
Fix inappropriate free()s of talloced content svn path=/import/netsurf/; revision=1619
This commit is contained in:
parent
2ef1e63d3d
commit
63c33349f0
|
@ -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_select_add_option(struct form_control *control, xmlNode *n);
|
||||||
static bool box_object(BOX_SPECIAL_PARAMS);
|
static bool box_object(BOX_SPECIAL_PARAMS);
|
||||||
static bool box_embed(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 box_iframe(BOX_SPECIAL_PARAMS);
|
||||||
static bool plugin_decode(struct content* content, struct box* box);
|
static bool plugin_decode(struct content* content, struct box* box);
|
||||||
static struct box_multi_length *box_parse_multi_lengths(const char *s,
|
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;
|
box->object_params = po;
|
||||||
|
|
||||||
/* start fetch */
|
/* start fetch */
|
||||||
if (plugin_decode(content, box))
|
if (!plugin_decode(content, box))
|
||||||
return false;
|
*convert_children = true;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -2207,12 +2207,21 @@ bool plugin_decode(struct content *content, struct box *box)
|
||||||
|
|
||||||
/* free pre-existing codebase */
|
/* free pre-existing codebase */
|
||||||
if (po->codebase)
|
if (po->codebase)
|
||||||
free(po->codebase);
|
talloc_free(po->codebase);
|
||||||
|
|
||||||
po->codebase = codebase;
|
po->codebase = talloc_strdup(content, codebase);
|
||||||
|
if (!po->codebase) {
|
||||||
|
free(codebase);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* no longer need this */
|
||||||
|
free(codebase);
|
||||||
|
|
||||||
/* Set basehref */
|
/* 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)
|
if (po->data == 0 && po->classid == 0)
|
||||||
/* no data => ignore this object */
|
/* no data => ignore this object */
|
||||||
|
@ -2242,8 +2251,14 @@ bool plugin_decode(struct content *content, struct box *box)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (po->codebase)
|
if (po->codebase)
|
||||||
free(po->codebase);
|
talloc_free(po->codebase);
|
||||||
po->codebase = codebase;
|
po->codebase = talloc_strdup(content,
|
||||||
|
codebase);
|
||||||
|
free(codebase);
|
||||||
|
if (!po->codebase) {
|
||||||
|
free(url);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
LOG(("ActiveX object"));
|
LOG(("ActiveX object"));
|
||||||
|
|
|
@ -1076,7 +1076,7 @@ void plugin_destroy_stream(struct content *c)
|
||||||
bool plugin_write_parameters_file(struct content *c,
|
bool plugin_write_parameters_file(struct content *c,
|
||||||
struct object_params *params)
|
struct object_params *params)
|
||||||
{
|
{
|
||||||
struct plugin_params *temp;
|
struct plugin_params *p;
|
||||||
struct plugin_param_item *ppi;
|
struct plugin_param_item *ppi;
|
||||||
struct plugin_param_item *pilist = 0;
|
struct plugin_param_item *pilist = 0;
|
||||||
char bgcolor[10] = {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
|
/* 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) {
|
for (p = params->params; p != 0; p = p->next) {
|
||||||
LOG(("name: %s", params->params->name == 0 ? "not set" : params->params->name));
|
LOG(("name: %s", p->name == 0 ? "not set" : p->name));
|
||||||
LOG(("value: %s", params->params->value == 0 ? "not set" : params->params->value));
|
LOG(("value: %s", p->value == 0 ? "not set" : p->value));
|
||||||
LOG(("type: %s", params->params->type == 0 ? "not set" : params->params->type));
|
LOG(("type: %s", p->type == 0 ? "not set" : p->type));
|
||||||
LOG(("valuetype: %s", params->params->valuetype));
|
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,
|
if (!plugin_add_item_to_pilist(&pilist,
|
||||||
PLUGIN_PARAMETER_DATA,
|
PLUGIN_PARAMETER_DATA,
|
||||||
(const char *)params->params->name,
|
(const char *)p->name,
|
||||||
(const char *)params->params->value,
|
(const char *)p->value,
|
||||||
(const char *)params->params->type))
|
(const char *)p->type))
|
||||||
goto error;
|
goto error;
|
||||||
if (strcasecmp(params->params->valuetype, "ref") == 0)
|
if (strcasecmp(p->valuetype, "ref") == 0)
|
||||||
if (!plugin_add_item_to_pilist(&pilist,
|
if (!plugin_add_item_to_pilist(&pilist,
|
||||||
PLUGIN_PARAMETER_URL,
|
PLUGIN_PARAMETER_URL,
|
||||||
(const char *)params->params->name,
|
(const char *)p->name,
|
||||||
(const char *)params->params->value,
|
(const char *)p->value,
|
||||||
(const char *)params->params->type))
|
(const char *)p->type))
|
||||||
goto error;
|
goto error;
|
||||||
if (strcasecmp(params->params->valuetype, "object") == 0)
|
if (strcasecmp(p->valuetype, "object") == 0)
|
||||||
if (!plugin_add_item_to_pilist(&pilist,
|
if (!plugin_add_item_to_pilist(&pilist,
|
||||||
PLUGIN_PARAMETER_OBJECT,
|
PLUGIN_PARAMETER_OBJECT,
|
||||||
(const char *)params->params->name,
|
(const char *)p->name,
|
||||||
(const char *)params->params->value,
|
(const char *)p->value,
|
||||||
(const char *)params->params->type))
|
(const char *)p->type))
|
||||||
goto error;
|
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 */
|
/* Now write mandatory special parameters */
|
||||||
|
@ -1263,19 +1252,6 @@ error:
|
||||||
ppi = 0;
|
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);
|
free(c->data.plugin.filename);
|
||||||
c->data.plugin.filename = 0;
|
c->data.plugin.filename = 0;
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue