]> git.refcnt.org Git - colorize.git/commitdiff
Clear pointer before reusing
authorSteven Schubiger <stsc@refcnt.org>
Thu, 5 Sep 2013 11:36:26 +0000 (13:36 +0200)
committerSteven Schubiger <stsc@refcnt.org>
Thu, 5 Sep 2013 11:36:26 +0000 (13:36 +0200)
colorize.c

index 1efc7d917794303de0132dd26b131bd0a30c4c06..35d14dccd491062c74b705b1977fce7600e45b29 100644 (file)
@@ -484,6 +484,8 @@ process_args (unsigned int arg_cnt, char **arg_strings, bool *bold, const struct
     for (index = 0, color = str; *color; index++, color = p)
       {
         char *ch, *sep;
+
+        p = NULL;
         if ((sep = strchr (color, COLOR_SEP_CHAR)))
           {
             *sep = '\0';
@@ -491,6 +493,7 @@ process_args (unsigned int arg_cnt, char **arg_strings, bool *bold, const struct
           }
         else
           p = color + strlen (color);
+        assert (p);
 
         for (ch = color; *ch; ch++)
           if (!isalpha (*ch))