fixed free() pointer error that was throwing segfaults on newer systems
authorLucas K <lkocia@s3miclassical.com>
Wed, 23 Dec 2020 18:28:08 +0000 (10:28 -0800)
committerLucas K <lkocia@s3miclassical.com>
Wed, 23 Dec 2020 18:28:08 +0000 (10:28 -0800)
exponentialsum.c

index 0e0bd6e8cd890ec0ade0f6496abef63872405725..cbf58d9592229fe629923e48c48a4f4c1883760f 100644 (file)
@@ -251,8 +251,9 @@ complex double exponentialsum(int *k, int *Q, int *D, int **J) {
       setWalker = setE; // 'a'=setE->data
       while(setWalker != NULL) {
        if(setWalker->next->data == setK->data) {
-         free(setWalker->next);
+         setWalker2 = setWalker->next;
          setWalker->next = setWalker->next->next; // delete 'b'
+         free(setWalker2);
          break;
        }
        setWalker = setWalker->next;