Skip to content

Commit

Permalink
fix freeing languages at switch
Browse files Browse the repository at this point in the history
  • Loading branch information
KrahJohlito committed Dec 29, 2020
1 parent 6c62ad9 commit 01d2159
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/lang.c
Original file line number Diff line number Diff line change
Expand Up @@ -354,9 +354,7 @@ static int lngLoadFromFile(char *path, char *name)

LOG("LANG Loaded %d entries\n", strId);

// remember how many entries were read from the file (for the free later)
nValidEntries = strId;

int newEntries = strId;
// if necessary complete lang with default internal
while (strId < LANG_STR_COUNT) {
LOG("LANG Default entry added: %s\n", internalEnglish[strId]);
Expand All @@ -366,6 +364,9 @@ static int lngLoadFromFile(char *path, char *name)
lang_strs = newL;
lngFreeFromFile(curL);

// remember how many entries were read from the file (for the free later)
nValidEntries = newEntries;

int len = strlen(path) - strlen(name) - 9; //-4 for extension, -5 for prefix
memcpy(dir, path, len);
dir[len] = '\0';
Expand Down

0 comments on commit 01d2159

Please sign in to comment.