On Fri, 2010-12-10 at 20:09 +0100, Samuel Ortiz wrote:
> On Mon, Dec 06, 2010 at 01:46:39PM +0000, David Woodhouse wrote:
> > It is now a string which must be free'd with g_free().
> >
> > A return of NULL will always be interpreted as "DIRECT", so no need to
> > return g_strdup("DIRECT");
> >
> > This means that __pacrunner_mozjs_execute() is no longer returning a pointer
> > to a character array which may disappear at any time if GC happens.
>
> All patches (and a couple more from your git tree) applied.
Thanks. In commit d3d0707a you seem to have undone some of this 'Fix
lifetime issues' patch, which became commit e4c11a9b.
This should fix it, and we can remove the now-incorrect comment from
v8.cc while we're at it...
diff --git a/plugins/mozjs.c b/plugins/mozjs.c
index f717ff2..c2ab761 100644
--- a/plugins/mozjs.c
+++ b/plugins/mozjs.c
@@ -220,7 +220,7 @@ static char * mozjs_execute(const char *url, const char
*host)
DBG("url %s host %s", url, host);
if (jsctx == NULL)
- return "DIRECT";
+ return NULL;
tmpurl = JS_strdup(jsctx, url);
tmphost = JS_strdup(jsctx, host);
@@ -250,7 +250,7 @@ static char * mozjs_execute(const char *url, const char
*host)
if (result) {
answer = JS_GetStringBytes(JS_ValueToString(jsctx, rval));
- return answer;
+ return g_strdup(answer);
}
return NULL;
diff --git a/plugins/v8.cc b/plugins/v8.cc
index 117e0f0..cc38189 100644
--- a/plugins/v8.cc
+++ b/plugins/v8.cc
@@ -274,7 +274,6 @@ static char *v8_execute(const char *url, const char *host)
return NULL;
}
- /* Hrm, how to fix this leak? */
char *retval = g_strdup(*v8::String::Utf8Value(result->ToString()));
if (!gc_source)
--
David Woodhouse Open Source Technology Centre
[email protected] Intel Corporation
_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman