diff options
author | Michael Schroeder <mls@suse.de> | 2014-03-05 15:48:33 +0100 |
---|---|---|
committer | Michael Schroeder <mls@suse.de> | 2014-03-05 15:48:33 +0100 |
commit | 147d0ddffe2334f8bf98fff630eb378d20a367f6 (patch) | |
tree | 43936aca60a16247cd54c348caf20fe46a40c5c3 /ext | |
parent | e67081ca53d718a041070da8b5fc92b7cec796e3 (diff) | |
download | libsolv-147d0ddffe2334f8bf98fff630eb378d20a367f6.tar.gz libsolv-147d0ddffe2334f8bf98fff630eb378d20a367f6.tar.bz2 libsolv-147d0ddffe2334f8bf98fff630eb378d20a367f6.zip |
delete broken solvables if the xml parser returns an error
Diffstat (limited to 'ext')
-rw-r--r-- | ext/repo_appdata.c | 7 | ||||
-rw-r--r-- | ext/repo_products.c | 6 | ||||
-rw-r--r-- | ext/repo_zyppdb.c | 5 |
3 files changed, 16 insertions, 2 deletions
diff --git a/ext/repo_appdata.c b/ext/repo_appdata.c index 986492b..63c03fc 100644 --- a/ext/repo_appdata.c +++ b/ext/repo_appdata.c @@ -511,7 +511,12 @@ repo_add_appdata(Repo *repo, FILE *fp, int flags) l = fread(buf, 1, sizeof(buf), fp); if (XML_Parse(parser, buf, l, l == 0) == XML_STATUS_ERROR) { - pool_error(pool, -1, "repo_appdata: %s at line %u:%u\n", XML_ErrorString(XML_GetErrorCode(parser)), (unsigned int)XML_GetCurrentLineNumber(parser), (unsigned int)XML_GetCurrentColumnNumber(parser)); + pool_error(pool, -1, "repo_appdata: %s at line %u:%u\n", XML_ErrorString(XML_GetErrorCode(parser)), (unsigned int)XML_GetCurrentLineNumber(parser), (unsigned int)XML_GetCurrentColumnNumber(parser)); + if (pd.solvable) + { + repo_free_solvable(repo, pd.solvable - pd.pool->solvables, 1); + pd.solvable = 0; + } ret = -1; break; } diff --git a/ext/repo_products.c b/ext/repo_products.c index 0294ff2..f7a36e1 100644 --- a/ext/repo_products.c +++ b/ext/repo_products.c @@ -451,8 +451,12 @@ add_code11_product(struct parsedata *pd, FILE *fp) if (XML_Parse(parser, buf, l, l == 0) == XML_STATUS_ERROR) { pool_debug(pd->pool, SOLV_ERROR, "%s: %s at line %u:%u\n", pd->filename, XML_ErrorString(XML_GetErrorCode(parser)), (unsigned int)XML_GetCurrentLineNumber(parser), (unsigned int)XML_GetCurrentColumnNumber(parser)); - pool_debug(pd->pool, SOLV_ERROR, "skipping this product\n"); XML_ParserFree(parser); + if (pd->solvable) + { + repo_free_solvable(pd->repo, pd->solvable - pd->pool->solvables, 1); + pd->solvable = 0; + } return; } if (l == 0) diff --git a/ext/repo_zyppdb.c b/ext/repo_zyppdb.c index 135a155..207f563 100644 --- a/ext/repo_zyppdb.c +++ b/ext/repo_zyppdb.c @@ -290,6 +290,11 @@ add_zyppdb_product(struct parsedata *pd, FILE *fp) if (XML_Parse(parser, buf, l, l == 0) == XML_STATUS_ERROR) { pool_debug(pd->pool, SOLV_ERROR, "repo_zyppdb: %s at line %u:%u\n", XML_ErrorString(XML_GetErrorCode(parser)), (unsigned int)XML_GetCurrentLineNumber(parser), (unsigned int)XML_GetCurrentColumnNumber(parser)); + if (pd->solvable) + { + repo_free_solvable(pd->repo, pd->solvable - pd->pool->solvables, 1); + pd->solvable = 0; + } return; } if (l == 0) |