utf8: don't allow NUL in decoded strings.
[ccan] / tools / ccanlint / tests / reduce_features.c
index 54c26f9736c6a96d3c49e6e0f50eb7379abcc5bb..34a897061bb4fbe16c69800bf699f930d753502b 100644 (file)
@@ -83,7 +83,7 @@ static struct htable_option *get_used_options(struct manifest *m)
                        info = get_ccan_line_info(f);
                        struct pp_conditions *prev = NULL;
 
-                       for (i = 0; i < f->num_lines; i++) {
+                       for (i = 0; f->lines[i]; i++) {
                                if (info[i].cond && info[i].cond != prev) {
                                        num += add_options(opts, info[i].cond);
                                        prev = info[i].cond;
@@ -130,7 +130,8 @@ static struct htable_option *get_config_options(struct manifest *m)
 }
 
 static void do_reduce_features(struct manifest *m,
-                              unsigned int *timeleft, struct score *score)
+                              unsigned int *timeleft UNNEEDED,
+                              struct score *score)
 {
        struct htable_option *options_used, *options_avail, *options;
        struct htable_option_iter i;
@@ -180,6 +181,7 @@ static void do_reduce_features(struct manifest *m,
                err(1, "Creating reduced-features/config.h");
        if (!write_all(fd, hdr, strlen(hdr)))
                err(1, "Writing reduced-features/config.h");
+       htable_option_free(options);
        close(fd);
        features_were_reduced = true;
 }