gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master b1a3c3a: The next pointer of the copy of named


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master b1a3c3a: The next pointer of the copy of named dataset reset to NULL
Date: Tue, 9 Oct 2018 16:47:31 -0400 (EDT)

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

    The next pointer of the copy of named dataset reset to NULL
    
    When a named operand is copied to be re-used in the stack, Arithmetic
    deleted (freed and set to NULL) the `name' pointer, but not the `next'
    pointer. This would cause a crash if the copy of the named dataset was
    later renamed. With this commit, we also set the `next' pointer to NULL.
    
    This fixes bug #54810.
---
 NEWS                      | 1 +
 bin/arithmetic/operands.c | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/NEWS b/NEWS
index 390b3dd..e84f45c 100644
--- a/NEWS
+++ b/NEWS
@@ -105,6 +105,7 @@ GNU Astronomy Utilities NEWS                          -*- 
outline -*-
   bug #54526: Invalid r, q and truncation of point profiles in MakeProfiles.
   bug #54579: NoiseChisel pseudo-detection failure when dataset is negative.
   bug #54782: Segment's check image not removing sky clumps some tiles.
+  bug #54810: Arithmetic crash when previously named operand renamed.
 
 
 
diff --git a/bin/arithmetic/operands.c b/bin/arithmetic/operands.c
index 92ebcc4..400a25d 100644
--- a/bin/arithmetic/operands.c
+++ b/bin/arithmetic/operands.c
@@ -127,6 +127,7 @@ operands_remove_name(struct arithmeticparams *p, char *name)
   /* Nothing in the list points to it now. So we can safely modify and
      return it. */
   free(removed->name);
+  removed->next=NULL;
   removed->name=NULL;
   return removed;
 }
@@ -218,6 +219,7 @@ operands_copy_named(struct arithmeticparams *p, char *name)
             out=gal_data_copy(tmp);
             free(out->name);
             out->name=NULL;
+            out->next=NULL;
           }
         /* The named operand is not used any more. Remove it from the list
            of named datasets and continue. */



reply via email to

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