[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnuastro-commits] master d82730f 2/4: Free Arithmetic's output after wr
From: |
Mohammad Akhlaghi |
Subject: |
[gnuastro-commits] master d82730f 2/4: Free Arithmetic's output after writing |
Date: |
Wed, 7 Sep 2016 17:07:04 +0000 (UTC) |
branch: master
commit d82730fa4fae6a7ca758a7376d7fa57bcfb94aef
Author: Mohammad Akhlaghi <address@hidden>
Commit: Mohammad Akhlaghi <address@hidden>
Free Arithmetic's output after writing
Arithmetic's output was not being freed after writing to a FITS file. This
has been corrected now.
---
src/arithmetic/arithmetic.c | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/src/arithmetic/arithmetic.c b/src/arithmetic/arithmetic.c
index a5255fd..dc7a3eb 100644
--- a/src/arithmetic/arithmetic.c
+++ b/src/arithmetic/arithmetic.c
@@ -132,7 +132,7 @@ pop_operand(struct imgarithparams *p, double *number,
double **array,
gal_fits_read_wcs(filename, hdu, 0, 0, &p->nwcs, &p->wcs);
}
gal_fits_file_to_double(filename, maskname, hdu, mhdu,
- array, &bitpix, &p->anyblank, &s0, &s1);
+ array, &bitpix, &p->anyblank, &s0, &s1);
/* If the output size was not set yet, then set it. Otherwise,
make sure the size of this image is the same as the previous
@@ -958,7 +958,7 @@ where(struct imgarithparams *p)
void
reversepolish(struct imgarithparams *p)
{
- float *farray;
+ void *array;
double number;
char *tokeepvalue;
struct gal_linkedlist_stll *token;
@@ -1031,15 +1031,14 @@ reversepolish(struct imgarithparams *p)
p->wcs, NULL, SPACK_STRING);
else
{
- gal_fits_change_type(p->operands->array, DOUBLE_IMG,
- p->s0*p->s1, p->anyblank,
- (void **)(&farray), p->type);
- gal_fits_array_to_file(p->cp.output, "astimgarith",
- p->type, farray, p->s0, p->s1,
- p->anyblank, p->wcs, NULL,
- SPACK_STRING);
+ gal_fits_change_type(p->operands->array, DOUBLE_IMG, p->s0*p->s1,
+ p->anyblank, &array, p->type);
+ gal_fits_array_to_file(p->cp.output, "astimgarith", p->type,
+ array, p->s0, p->s1, p->anyblank, p->wcs,
+ NULL, SPACK_STRING);
+ free(array);
}
-
+ free(p->operands->array);
}
else
printf("%g\n", p->operands->number);