summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasper St. Pierre <jstpierre@mecheye.net>2012-07-13 16:46:46 -0400
committerJasper St. Pierre <jstpierre@mecheye.net>2012-07-13 19:24:57 -0400
commitb3fa00a4236d08e1ce61754615ca9a920480b6a9 (patch)
treefa5cdb5fcdd466d28cf3007385b1ce512c0a6613
parent54d60c278a39ce681b35d172b675a4b2d4449b65 (diff)
downloadgjs-b3fa00a4236d08e1ce61754615ca9a920480b6a9.tar.gz
Various bugs and issues caught by the Clang static analyzer
https://bugzilla.gnome.org/show_bug.cgi?id=679897
-rw-r--r--gi/arg.c5
-rw-r--r--gi/function.c2
-rw-r--r--gi/object.c6
-rw-r--r--util/log.c4
4 files changed, 13 insertions, 4 deletions
diff --git a/gi/arg.c b/gi/arg.c
index 25f18085..3f82d9c5 100644
--- a/gi/arg.c
+++ b/gi/arg.c
@@ -251,6 +251,7 @@ type_needs_out_release(GITypeInfo *type_info,
case GI_INFO_TYPE_ENUM:
case GI_INFO_TYPE_FLAGS:
needs_release = FALSE;
+ break;
default:
needs_release = TRUE;
@@ -1937,6 +1938,8 @@ gjs_array_from_carray_internal (JSContext *context,
GITypeTag element_type;
guint i;
+ result = JS_FALSE;
+
element_type = g_type_info_get_tag(param_info);
if (is_gvalue_flat_array(param_info, element_type))
@@ -2124,6 +2127,8 @@ gjs_array_from_zero_terminated_c_array (JSContext *context,
GITypeTag element_type;
guint i;
+ result = JS_FALSE;
+
element_type = g_type_info_get_tag(param_info);
/* Special case array(guint8) */
diff --git a/gi/function.c b/gi/function.c
index 1f8ac3d0..a4209d21 100644
--- a/gi/function.c
+++ b/gi/function.c
@@ -282,6 +282,7 @@ gjs_callback_closure(ffi_cif *cif,
}
if (trampoline->is_vfunc) {
+ g_assert(n_args > 0);
this_object = JSVAL_TO_OBJECT(jsargs[0]);
jsargs++;
n_jsargs--;
@@ -665,7 +666,6 @@ gjs_invoke_c_function(JSContext *context,
failed = FALSE;
c_arg_pos = 0; /* index into in_arg_cvalues, etc */
- gi_arg_pos = 0; /* index into function->info arguments */
js_arg_pos = 0; /* index into argv */
if (is_method) {
diff --git a/gi/object.c b/gi/object.c
index 9942ee28..d9cfb689 100644
--- a/gi/object.c
+++ b/gi/object.c
@@ -1392,11 +1392,13 @@ emit_func(JSContext *context,
if (signal_query.return_type != G_TYPE_NONE) {
if (!gjs_value_from_g_value(context,
- &retval,
- &rvalue))
+ &retval,
+ &rvalue))
failed = TRUE;
g_value_unset(&rvalue);
+ } else {
+ retval = JSVAL_VOID;
}
for (i = 0; i < (signal_query.n_params + 1); ++i) {
diff --git a/util/log.c b/util/log.c
index e52daf58..64971a02 100644
--- a/util/log.c
+++ b/util/log.c
@@ -184,7 +184,6 @@ gjs_debug(GjsDebugTopic topic,
return;
error = FALSE;
- prefix = "???";
switch (topic) {
case GJS_DEBUG_STRACE_TIMESTAMP:
/* return early if strace timestamps are disabled, avoiding
@@ -280,6 +279,9 @@ gjs_debug(GjsDebugTopic topic,
case GJS_DEBUG_GERROR:
prefix = "JS G ERR";
break;
+ default:
+ prefix = "???";
+ break;
}
if (!is_allowed_prefix(prefix))