From: Adam Dickmeiss Date: Thu, 12 May 2011 13:04:16 +0000 (+0200) Subject: SOLR decode: avoid creating empty records array X-Git-Tag: v4.2.0~16 X-Git-Url: http://lists.indexdata.dk/?a=commitdiff_plain;h=369d5e89785b7aefa6a269724692586af0215a91;p=yaz-moved-to-github.git SOLR decode: avoid creating empty records array Do not create records array if num_records == 0. --- diff --git a/src/solr.c b/src/solr.c index 0fd1480..c13c4ed 100644 --- a/src/solr.c +++ b/src/solr.c @@ -59,8 +59,9 @@ static void yaz_solr_decode_result_docs(ODR o, xmlNodePtr ptr, for (node = ptr->children; node; node = node->next) if (node->type == XML_ELEMENT_NODE) sr->num_records++; - - sr->records = odr_malloc(o, sizeof(*sr->records) * sr->num_records); + + if (sr->num_records) + sr->records = odr_malloc(o, sizeof(*sr->records) * sr->num_records); for (node = ptr->children; node; node = node->next) {