tools: avoid needless post increment on size
[ccan] / tools / namespacize.c
index 5ac85f502f2abb0f5cc9cea1d583c68fdf5546d0..cf6bc26d7c4983a8d3483c976ecb9428ad8ebaac 100644 (file)
@@ -53,7 +53,8 @@ static char **get_dir(const char *dir)
                names[size++]
                        = talloc_asprintf(names, "%s/%s", dir, ent->d_name);
        }
                names[size++]
                        = talloc_asprintf(names, "%s/%s", dir, ent->d_name);
        }
-       names[size++] = NULL;
+       /* FIXME: if the loop doesn't run at least once, we'll segfault here */
+       names[size] = NULL;
        closedir(d);
        return names;
 }
        closedir(d);
        return names;
 }