summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Zeuthen <davidz@redhat.com>2012-05-18 15:30:48 -0400
committerDavid Zeuthen <davidz@redhat.com>2012-05-18 15:30:48 -0400
commit82e468369c3a8a0ec49b912660cba107252308b6 (patch)
treee404ca85531ca719617ccd3178f1a6dac472cda7
parent5957b6c4f148794710bab8dd05c7f654871c7455 (diff)
downloadpolkit-82e468369c3a8a0ec49b912660cba107252308b6.tar.gz
Add a couple of more error checks
Signed-off-by: David Zeuthen <davidz@redhat.com>
-rw-r--r--src/polkitbackend/polkitbackendjsauthority.c29
1 files changed, 19 insertions, 10 deletions
diff --git a/src/polkitbackend/polkitbackendjsauthority.c b/src/polkitbackend/polkitbackendjsauthority.c
index a0f9e27..9d721f3 100644
--- a/src/polkitbackend/polkitbackendjsauthority.c
+++ b/src/polkitbackend/polkitbackendjsauthority.c
@@ -584,11 +584,15 @@ subject_to_jsval (PolkitBackendJsAuthority *authority,
src = "new Subject();";
- JS_EvaluateScript (authority->priv->cx,
- authority->priv->js_global,
- src, strlen (src),
- __FILE__, __LINE__,
- &ret_jsval);
+ if (!JS_EvaluateScript (authority->priv->cx,
+ authority->priv->js_global,
+ src, strlen (src),
+ __FILE__, __LINE__,
+ &ret_jsval))
+ {
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "Evaluting '%s' failed", src);
+ goto out;
+ }
obj = JSVAL_TO_OBJECT (ret_jsval);
@@ -702,11 +706,15 @@ details_to_jsval (PolkitBackendJsAuthority *authority,
src = "new Details();";
- JS_EvaluateScript (authority->priv->cx,
- authority->priv->js_global,
- src, strlen (src),
- __FILE__, __LINE__,
- &ret_jsval);
+ if (!JS_EvaluateScript (authority->priv->cx,
+ authority->priv->js_global,
+ src, strlen (src),
+ __FILE__, __LINE__,
+ &ret_jsval))
+ {
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "Evaluting '%s' failed", src);
+ goto out;
+ }
obj = JSVAL_TO_OBJECT (ret_jsval);
keys = polkit_details_get_keys (details);
@@ -726,6 +734,7 @@ details_to_jsval (PolkitBackendJsAuthority *authority,
ret = TRUE;
+ out:
if (ret && out_jsval != NULL)
*out_jsval = ret_jsval;