Print this page
OS-1576 Sundry uninitialised variables
Reviewed by: Robert Mustacchi <rm@joyent.com>

@@ -1497,11 +1497,11 @@
  * undefined, prints the token position instead.
  */
 static int
 jsfunc_lineno(uintptr_t lendsp, uintptr_t tokpos, char *buf, size_t buflen)
 {
-        uintptr_t size, bufsz, lower, upper, ii;
+        uintptr_t size, bufsz, lower, upper, ii = 0;
         uintptr_t *data;
 
         if (jsobj_is_undefined(lendsp)) {
                 /*
                  * The token position is an SMI, but it comes in as its raw

@@ -2832,11 +2832,11 @@
 dcmd_v8field(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
 {
         v8_class_t *clp;
         v8_field_t *flp;
         const char *klass, *field;
-        uintptr_t offset;
+        uintptr_t offset = 0;
 
         /*
          * We may be invoked with either two arguments (class and field name) or
          * three (an offset to save).
          */

@@ -2992,11 +2992,11 @@
 
 /* ARGSUSED */
 static int
 dcmd_v8load(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
 {
-        v8_cfg_t *cfgp, **cfgpp;
+        v8_cfg_t *cfgp = NULL, **cfgpp;
 
         if (v8_classes != NULL) {
                 mdb_warn("v8 module already configured\n");
                 return (DCMD_ERR);
         }

@@ -3008,11 +3008,11 @@
                 cfgp = *cfgpp;
                 if (strcmp(argv->a_un.a_str, cfgp->v8cfg_name) == 0)
                         break;
         }
 
-        if (cfgp->v8cfg_name == NULL) {
+        if (cfgp == NULL || cfgp->v8cfg_name == NULL) {
                 mdb_warn("unknown configuration: \"%s\"\n", argv->a_un.a_str);
                 return (DCMD_ERR);
         }
 
         if (autoconfigure(cfgp) == -1) {