summaryrefslogtreecommitdiff
path: root/plugin
diff options
context:
space:
mode:
authorSamuel Lidén Borell <samuel@slbdata.se>2009-06-25 17:09:09 +0200
committerSamuel Lidén Borell <samuel@slbdata.se>2010-01-02 22:30:11 +0100
commit8908f8d2caf437f26a14b72c1484afe99751fa8a (patch)
treec2c47590a2a0abde9cf70928a1b93c8fad4dc13b /plugin
parentf1f63618a8f1943a247824b301631fb632bb5fae (diff)
downloadfribid-8908f8d2caf437f26a14b72c1484afe99751fa8a.tar.gz
fribid-8908f8d2caf437f26a14b72c1484afe99751fa8a.tar.bz2
fribid-8908f8d2caf437f26a14b72c1484afe99751fa8a.zip
Don't (indirectly) double-free a string in GetParam
Diffstat (limited to 'plugin')
-rw-r--r--plugin/npobject.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/plugin/npobject.c b/plugin/npobject.c
index 0dc29c8..10dbfa3 100644
--- a/plugin/npobject.c
+++ b/plugin/npobject.c
@@ -210,8 +210,12 @@ static bool objInvoke(NPObject *npobj, NPIdentifier ident,
char *value = sign_getParam(this->plugin, param);
free(param);
- if (value) STRINGZ_TO_NPVARIANT(npstr(value), *result);
- else NULL_TO_NPVARIANT(*result);
+ if (value) {
+ // The macro below evaluates it's first parameter twice
+ // and npstr frees it's input...
+ value = npstr(value);
+ STRINGZ_TO_NPVARIANT(value, *result);
+ } else NULL_TO_NPVARIANT(*result);
return true;
} else if (!strcmp(name, "SetParam") && (argCount == 2) &&