From: Adam Dickmeiss Date: Wed, 20 Mar 2013 14:43:26 +0000 (+0100) Subject: Ensure show_range_start returns non-null X-Git-Tag: v1.6.28~1 X-Git-Url: http://sru.miketaylor.org.uk/?a=commitdiff_plain;h=8e14ee4be4caa036057d7d7a13cce8ecd06f2fc2;p=pazpar2-moved-to-github.git Ensure show_range_start returns non-null if session is still locked. So that show_records properly unlocks again. --- diff --git a/src/session.c b/src/session.c index 4603f2d..5e39968 100644 --- a/src/session.c +++ b/src/session.c @@ -1317,9 +1317,7 @@ struct record_cluster **show_range_start(struct session *se, client_update_show_stat(rec->client, 1); } } - if (*num > 0) - recs = - nmem_malloc(se->nmem, *num * sizeof(struct record_cluster *)); + recs = nmem_malloc(se->nmem, (*num > 0 ? *num : 1) * sizeof(*recs)); for (i = 0; i < *num; i++) { struct record_cluster *r = reclist_read_record(se->reclist);