From 161e97d7b3f015a1a9253a3f86f59ecd3ea4ecaa Mon Sep 17 00:00:00 2001 From: Uwe Schulzweida <uwe.schulzweida@mpimet.mpg.de> Date: Wed, 19 Feb 2025 08:06:07 +0000 Subject: [PATCH] Use static stack allocation for chunks. --- src/stream_cdf_i.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/stream_cdf_i.c b/src/stream_cdf_i.c index b599c5f49..94e6c6430 100644 --- a/src/stream_cdf_i.c +++ b/src/stream_cdf_i.c @@ -1155,7 +1155,7 @@ set_vars_chunks(int ncid, int ncvarid, int nvdims, ncvar_t *ncvar) ncvar->hasFilter = cdf_get_var_filter(ncid, ncvarid, ncvar->filterSpec, CDI_MAX_NAME); // if (ncvar->hasFilter) printf("filterSpec: %s=%s\n", ncvar->name, ncvar->filterSpec); - size_t* chunks = malloc(sizeof(size_t) * nvdims); + size_t chunks[MAX_DIMS_CDF]; int storageIn; if (nc_inq_var_chunking(ncid, ncvarid, &storageIn, chunks) == NC_NOERR) { @@ -1171,7 +1171,6 @@ set_vars_chunks(int ncid, int ncvarid, int nvdims, ncvar_t *ncvar) } } } - free (chunks); size_t size; size_t nelems; -- GitLab