Also, this could probably be simplified to:

```c
// avoid allocating zero bytes
char **lines = (new_len == 3) ? NULL : xmalloc(new_len * sizeof(char *));
```

Also the usage of `xcalloc()` seems wrong, the arguments should be reversed.