Fix memory leak in wesnothd

Another possible part of [bug #21267](https://gna.org/bugs/?21267).