forked from github/server
free race prefixes when the game is done (small memory leak).
This commit is contained in:
parent
f1476c2167
commit
44d982d210
|
@ -74,6 +74,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include <util/xml.h>
|
||||
|
||||
#include "donations.h"
|
||||
#include "prefix.h"
|
||||
|
||||
#ifdef USE_LIBXML2
|
||||
/* libxml includes */
|
||||
|
@ -1767,6 +1768,7 @@ void free_gamedata(void)
|
|||
free_units();
|
||||
free_regions();
|
||||
free_borders();
|
||||
free_prefixes();
|
||||
|
||||
for (i = 0; i != MAXLOCALES; ++i) {
|
||||
if (defaults[i]) {
|
||||
|
|
11
src/prefix.c
11
src/prefix.c
|
@ -19,3 +19,14 @@ void add_raceprefix(const char *prefix)
|
|||
race_prefixes[next++] = _strdup(prefix);
|
||||
race_prefixes[next] = NULL;
|
||||
}
|
||||
|
||||
void free_prefixes(void) {
|
||||
int i;
|
||||
if (race_prefixes) {
|
||||
for (i = 0; race_prefixes[i]; ++i) {
|
||||
free(race_prefixes[i]);
|
||||
}
|
||||
free(race_prefixes);
|
||||
race_prefixes = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,8 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
void add_raceprefix(const char *);
|
||||
char **race_prefixes;
|
||||
char **race_prefixes; // zero-terminated array of valid prefixes
|
||||
void free_prefixes(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue