From 80a574dc26a78a6097ef5962ee2bd352de62f0d5 Mon Sep 17 00:00:00 2001
From: ShubhamDesai <42180509+ShubhamDesai@users.noreply.github.com>
Date: Mon, 2 Dec 2024 17:10:55 -0500
Subject: [PATCH] lib/gpde: Fix Resource Leak issue in n_arrays_io.c (#4775)

---
 lib/gpde/n_arrays_io.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/gpde/n_arrays_io.c b/lib/gpde/n_arrays_io.c
index eae8a9065c6..5836df00754 100644
--- a/lib/gpde/n_arrays_io.c
+++ b/lib/gpde/n_arrays_io.c
@@ -150,6 +150,7 @@ N_array_2d *N_read_rast_to_array_2d(char *name, N_array_2d *array)
 
     /* Close file */
     Rast_close(map);
+    G_free(rast);
 
     return data;
 }
@@ -219,6 +220,9 @@ void N_write_array_2d_to_rast(N_array_2d *array, char *name)
 
     /* Close file */
     Rast_close(map);
+    G_free(rast);
+    G_free(frast);
+    G_free(drast);
 }
 
 /* ******************** 3D ARRAY FUNCTIONS *********************** */