gnuastro-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnuastro-commits] master c1cae38: Proper cleanup in gal_wcs_pixel_scale


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master c1cae38: Proper cleanup in gal_wcs_pixel_scale
Date: Tue, 4 Jul 2017 19:49:11 -0400 (EDT)

branch: master
commit c1cae38de39e8831bd126754255222791a38e325
Author: Mohammad Akhlaghi <address@hidden>
Commit: Mohammad Akhlaghi <address@hidden>

    Proper cleanup in gal_wcs_pixel_scale
    
    In the previous commit where the `pixscale' `gal_data_t' was introduced, we
    were just returning its `array' element and leaving the rest of the
    `gal_data_t' un-freed. This is corrected with this commit.
---
 lib/wcs.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/lib/wcs.c b/lib/wcs.c
index 583a313..1fe18da 100644
--- a/lib/wcs.c
+++ b/lib/wcs.c
@@ -437,8 +437,8 @@ gal_wcs_angular_distance_deg(double r1, double d1, double 
r2, double d2)
 double *
 gal_wcs_pixel_scale(struct wcsprm *wcs)
 {
-  double *a;
   gsl_vector S;
+  double *a, *out;
   int permute_set;
   gsl_matrix A, V;
   size_t i, j, n=wcs->naxis;
@@ -504,7 +504,10 @@ gal_wcs_pixel_scale(struct wcsprm *wcs)
   free(a);
   free(v);
   free(permutation);
-  return pixscale->array;
+  out=pixscale->array;
+  pixscale->array=NULL;
+  gal_data_free(pixscale);
+  return out;
 }
 
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]