- old_len = talloc_array_length(c->output);
- c->output = talloc_realloc(c, c->output, char,
- old_len + 1024);
- len = read(c->output_fd, c->output + old_len, 1024);
+ /* This length includes nul terminator! */
+ old_len = tal_count(c->output);
+ tal_resize(&c->output, old_len + 1024);
+ len = read(c->output_fd, c->output + old_len - 1, 1024);