From 633fcfe5cfd32299321b7d39199382879f810bdd Mon Sep 17 00:00:00 2001 From: Attila Kovacs Date: Tue, 10 Dec 2024 16:43:29 +0100 Subject: [PATCH] Update for small tweaks in xchange lib --- src/resp.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/resp.c b/src/resp.c index 5ec74cd..be0517c 100644 --- a/src/resp.c +++ b/src/resp.c @@ -583,13 +583,13 @@ static XField *respArrayToXField(const char *name, const RESP **component, int n // -------------------------------------------------------- // Heterogeneous array... - XField *array; - - f = xCreateMixed1DField(name, n); - - if(!f->value) return x_trace_null(fn, "field array"); + XField *array = (XField *) calloc(n, sizeof(XField)); + if(!array) { + x_error(0, errno, fn, "alloc error (%d XField)", n); + return NULL; + } - array = (XField *) f->value; + f = xCreateMixed1DField(name, n, array); for(i = 0; i < n; i++) { XField *e = redisxRESP2XField(array[i].name, component[i]); @@ -608,7 +608,7 @@ static XField *respArrayToXField(const char *name, const RESP **component, int n char *array; size_t eSize; - if(eType == X_UNKNOWN) return xCreateMixed1DField(name, 0); + if(eType == X_UNKNOWN) return xCreateMixed1DField(name, 0, NULL); eSize = xElementSizeOf(eType); array = (char *) calloc(1, n * eSize);