From 369d5e89785b7aefa6a269724692586af0215a91 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Thu, 12 May 2011 15:04:16 +0200 Subject: [PATCH] SOLR decode: avoid creating empty records array Do not create records array if num_records == 0. --- src/solr.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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) { -- 1.7.10.4