projects
/
yaz-moved-to-github.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
34356a0
)
SOLR decode: avoid creating empty records array
author
Adam Dickmeiss
<adam@indexdata.dk>
Thu, 12 May 2011 13:04:16 +0000
(15:04 +0200)
committer
Adam Dickmeiss
<adam@indexdata.dk>
Thu, 12 May 2011 13:04:16 +0000
(15:04 +0200)
Do not create records array if num_records == 0.
src/solr.c
patch
|
blob
|
history
diff --git
a/src/solr.c
b/src/solr.c
index
0fd1480
..
c13c4ed
100644
(file)
--- 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)
{