summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPatrick McDermott <patrick.mcdermott@libiquity.com>2021-03-17 11:01:50 (EDT)
committer Patrick McDermott <patrick.mcdermott@libiquity.com>2021-03-17 11:01:50 (EDT)
commitaaa24157f390ae5ec0a3d8ce221faba2db903cb1 (patch)
tree1f9994e684e8a9051878e066fccf5670d13fb405 /src
parent8028e0c5f7c56c4932de1e9a60a9e99b79d65803 (diff)
downloaddodge-balls-aaa24157f390ae5ec0a3d8ce221faba2db903cb1.zip
dodge-balls-aaa24157f390ae5ec0a3d8ce221faba2db903cb1.tar.gz
dodge-balls-aaa24157f390ae5ec0a3d8ce221faba2db903cb1.tar.bz2
game: Free old name/description when replacing
Diffstat (limited to 'src')
-rw-r--r--src/game.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/game.c b/src/game.c
index 75238f3..be3d40d 100644
--- a/src/game.c
+++ b/src/game.c
@@ -238,6 +238,10 @@ _db_game_xml_game_el_start(void *pv, const char *name, const char **attr)
NULL);
goto name_err;
name_ok:
+ if (game->name != NULL) {
+ free(game->name);
+ game->name = NULL;
+ }
game->xml_parsing = DB_GAME_XML_PARSING_NAME;
db_xml_node_push(p, game, _db_game_xml_invalid_start,
_db_game_xml_name_end,
@@ -259,6 +263,10 @@ _db_game_xml_game_el_start(void *pv, const char *name, const char **attr)
NULL);
goto desc_err;
desc_ok:
+ if (game->desc != NULL) {
+ free(game->desc);
+ game->desc = NULL;
+ }
game->xml_parsing = DB_GAME_XML_PARSING_DESCRIPTION;
db_xml_node_push(p, game, _db_game_xml_invalid_start,
_db_game_xml_description_end,