summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/game.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/game.c b/src/game.c
index 3eea396..29168cd 100644
--- a/src/game.c
+++ b/src/game.c
@@ -77,6 +77,7 @@ _db_game_xml_cdata(void *pv, const char *s, int len)
char *s_z;
char *s_z_trimmed;
char *s_z_trimmed_end;
+ char *old_data;
db_dbg( "[CDATA]");
@@ -95,6 +96,7 @@ _db_game_xml_cdata(void *pv, const char *s, int len)
--len;
}
if (*s_z_trimmed == '\0') {
+ free(s_z);
return;
}
s_z_trimmed_end = s_z_trimmed + len - 1;
@@ -103,7 +105,13 @@ _db_game_xml_cdata(void *pv, const char *s, int len)
}
*(s_z_trimmed_end + 1) = '\0';
- *data = strdup(s_z_trimmed);
+ if (*data != NULL && **data != '\0') {
+ old_data = *data;
+ sprintf(*data, "%s %s", *data, strdup(s_z_trimmed));
+ free(old_data);
+ } else {
+ *data = strdup(s_z_trimmed);
+ }
free(s_z);
}