summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2003-06-07 22:24:22 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2003-06-07 22:24:22 +0000
commitdfdf69fc915968192475ac447b469d7bfa3e23f4 (patch)
tree168176f02ab88162a8764f0086e0f39c89da2190
parent15a6d278a7a88afc529011af01d308e07f5548dd (diff)
downloadnetsurf-dfdf69fc915968192475ac447b469d7bfa3e23f4.tar.gz
netsurf-dfdf69fc915968192475ac447b469d7bfa3e23f4.tar.bz2
[project @ 2003-06-07 22:24:22 by jmb]
Fix plugin memory leaks. svn path=/import/netsurf/; revision=177
-rw-r--r--render/box.c30
-rw-r--r--riscos/plugin.c23
2 files changed, 27 insertions, 26 deletions
diff --git a/render/box.c b/render/box.c
index b9d566c2b..af1c88c9e 100644
--- a/render/box.c
+++ b/render/box.c
@@ -1,5 +1,5 @@
/**
- * $Id: box.c,v 1.49 2003/06/06 03:12:28 jmb Exp $
+ * $Id: box.c,v 1.50 2003/06/07 22:24:22 jmb Exp $
*/
#include <assert.h>
@@ -253,6 +253,16 @@ struct box * convert_xml_to_box(xmlNode * n, struct content *content,
} else if (strcmp((const char*) n->name, "object") == 0) { LOG(("object"));
box = box_object(n, content, style, href);
+ /* TODO - param data structure
+
+ for (c = n->children; c != 0; c = c->next) {
+
+ if (strcmp((const char*) c->name, "param") == 0) {
+
+ LOG(("param"));
+ current_param = box_param(c, style, current_object);
+ }
+ } */
} else if (strcmp((const char*) n->name, "embed") == 0) { LOG(("embed"));
box = box_embed(n, content, style, href);
@@ -1454,14 +1464,6 @@ struct box* box_object(xmlNode *n, struct content *content,
xmlFree(s);
}
- /* object param */
- if ((s = (char *) xmlGetProp(n, (const xmlChar *) "param"))) {
-
- /* TODO - create data structure to hold param elements */
- LOG(("param: %s", s));
- xmlFree(s);
- }
-
/* object width */
if ((s = (char *) xmlGetProp(n, (const xmlChar *) "width"))) {
@@ -1511,15 +1513,7 @@ struct box* box_embed(xmlNode *n, struct content *content,
xmlFree(s);
}
- /* embed param */
- if ((s = (char *) xmlGetProp(n, (const xmlChar *) "param"))) {
-
- /* TODO - create data structure for param elements */
- LOG(("param '%s'", s));
- xmlFree(s);
- }
-
- /* start fetch */
+ /* start fetch */
plugin_decode(content, url, box, po);
return box;
diff --git a/riscos/plugin.c b/riscos/plugin.c
index 7061d56d8..ec5ccc0f2 100644
--- a/riscos/plugin.c
+++ b/riscos/plugin.c
@@ -1,5 +1,5 @@
/**
- * $Id: plugin.c,v 1.8 2003/06/06 08:10:54 jmb Exp $
+ * $Id: plugin.c,v 1.9 2003/06/07 22:24:22 jmb Exp $
*/
#include <assert.h>
@@ -18,7 +18,8 @@
char* create_mime_from_ext(char* data);
char* create_sysvar(char* mime);
-void plugin_fetch(/* vars here */);
+void plugin_fetch(struct plugin_object* po,
+ char* alias_sysvar/* vars here */);
/**
* plugin_decode
@@ -155,10 +156,10 @@ void plugin_decode(struct content* content, char* url, struct box* box,
*/
xfree(po);
LOG(("sending data to image handler"));
- /* TODO - get image handler to draw it */
- /*html_fetch_image(content, url, box);*/
+ html_fetch_image(content, url, box);
+ return;
}
- else { /* not an image; is sys var set? */
+ else { /* not an image; is sys var set? */
/* Create Alias variable */
alias_sysvar = create_sysvar(po->type);
@@ -190,7 +191,7 @@ void plugin_decode(struct content* content, char* url, struct box* box,
else {
/* yes, it exists */
LOG(("%s exists", alias_sysvar));
- plugin_fetch(/* insert vars here */);
+ plugin_fetch(po, alias_sysvar/* insert vars here */);
}
}
}
@@ -216,6 +217,7 @@ char* create_mime_from_ext(char* data){
LOG(("Creating Mime Type from File Extension"));
+ ret = xcalloc(90, sizeof(char));
ret = strrchr(data, '.');
LOG(("Extension = %s", ret));
@@ -246,7 +248,8 @@ char* create_sysvar(char* mime) {
LOG(("Creating System Variable from Mime Type"));
ret = xcalloc(22, sizeof(char));
- ret = strdup("Alias$@PlugInType_");
+ ft = xcalloc(10, sizeof(char));
+ strcpy(ret, "Alias$@PlugInType_");
LOG(("Mime Type: %s", mime));
@@ -261,6 +264,7 @@ char* create_sysvar(char* mime) {
LOG(("Alias Var: %s", ret));
}
+ xfree(ft);
return ret;
}
@@ -269,8 +273,11 @@ char* create_sysvar(char* mime) {
* attempts to negotiate with the plugin.
* also fetches the object for the plugin to handle.
*/
-void plugin_fetch (/* insert vars here */) {
+void plugin_fetch (struct plugin_object* po,
+ char* alias_sysvar/* insert vars here */) {
LOG(("Entering plugin_fetch"));
+ xfree(po);
+ xfree(alias_sysvar);
return;
}