From eed88a74ea1bcca0a0895a74834e830ebbabeeb8 Mon Sep 17 00:00:00 2001 From: Ed Hartnett Date: Mon, 25 Mar 2019 06:04:25 -0600 Subject: [PATCH] fixed memory leak on error warning from codacy --- src/clib/pioc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/clib/pioc.c b/src/clib/pioc.c index 50b119375d1..eff9feba4ce 100644 --- a/src/clib/pioc.c +++ b/src/clib/pioc.c @@ -533,7 +533,10 @@ int PIOc_InitDecomp(int iosysid, int pio_type, int ndims, const int *gdimlen, in if (!(tmpsort = malloc(sizeof(struct sort_map) * maplen))) return pio_err(ios, NULL, PIO_ENOMEM, __FILE__, __LINE__); if (!(iodesc->remap = malloc(sizeof(int) * maplen))) + { + free(tmpsort); return pio_err(ios, NULL, PIO_ENOMEM, __FILE__, __LINE__); + } for (int m=0; m < maplen; m++) { tmpsort[m].remap = m;