From 63c33349f01933f7afb8e60e09e2fd533cf955c0 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Sat, 9 Apr 2005 22:56:34 +0000 Subject: [project @ 2005-04-09 22:56:34 by jmb] Fix inappropriate free()s of talloced content svn path=/import/netsurf/; revision=1619 --- riscos/plugin.c | 62 ++++++++++++++++++--------------------------------------- 1 file changed, 19 insertions(+), 43 deletions(-) (limited to 'riscos/plugin.c') 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; -- cgit v1.2.3