Commits

Anonymous committed 474cc2a

memory leak fix.

  • Participants
  • Parent commits df83eba

Comments (0)

Files changed (5)

File usort/f8_sort.c

     unsigned long long *reader, *writer, *buf1 = (unsigned long long*) a, *buf2;
     unsigned long *b0, *b1, *b2, *b3, *b4, *b5;
 
-    if (sz < 2048) { f8_csort(a,sz); return; } 
+    if (sz < 2048) return f8_csort(a,sz);  
     buf2  = (unsigned long long*) malloc(sz * sizeof(double));
     b0   = calloc(F8_SORT_HIST_SIZE * 6 , sizeof(unsigned long));
     b1   = b0 + F8_SORT_HIST_SIZE;    b2   = b1 + F8_SORT_HIST_SIZE;

File usort/s4_sort.c

     long n, sum0=0 , sum1=0 , sum2=0 , tsum=0;
     int *reader, *writer, *buf = (int*) malloc(sz * sizeof(int));
     size_t *b0, *b1, *b2;
-    if (sz < 256) { s4_csort(a,sz); return; }
+    if (sz < 256) { free(buf); return s4_csort(a,sz); }
     b0   = malloc(HIST_SIZE * 3 * sizeof(size_t));
     b1   = b0 + HIST_SIZE;
     b2   = b1 + HIST_SIZE;

File usort/s8_sort.c

     unsigned long pos;
     long n, sum0=0,sum1=0,sum2=0,sum3=0,sum4=0,sum5=0,tsum=0;
     long long *reader, *writer, *buf = ( long long*) malloc(sz * sizeof( long long));
-    if (sz < 2048) return s8_csort(a,sz);
+    if (sz < 2048) { free(buf) ; return s8_csort(a,sz); }
     if (sz < 0) { fprintf(stderr,"s8_sort: sz of array < 0: %ld\n",sz); exit(1); }
     long *b0, *b1, *b2, *b3, *b4, *b5;
     b0   = ( long*) malloc(HIST_SIZE * 6 * sizeof(long));

File usort/u4_sort.c

     long n, sum0=0 , sum1=0 , sum2=0 , tsum=0;
     unsigned *reader, *writer, *buf = (unsigned*) malloc(sz * sizeof(unsigned));
     size_t *b0, *b1, *b2;
-    if (sz < 256) { u4_csort(a,sz); return; }
+    if (sz < 256) { free(buf) ; return u4_csort(a,sz);  }
     b0   = malloc(HIST_SIZE * 3 * sizeof(size_t));
     b1   = b0 + HIST_SIZE;
     b2   = b1 + HIST_SIZE;

File usort/u8_sort.c

     unsigned long pos;
     unsigned long long n, sum0=0,sum1=0,sum2=0,sum3=0,sum4=0,sum5=0,tsum=0;
     unsigned long long *reader, *writer, *buf = (unsigned long long*) malloc(sz * sizeof(unsigned long long));
-    if (sz < 2048) return u8_csort(a,sz);
+    if (sz < 2048) { free(buf) ; return u8_csort(a,sz); }
     if (sz < 0) { fprintf(stderr,"u8_sort: sz of array < 0: %ld\n",sz); exit(1); }
     unsigned long long *b0, *b1, *b2, *b3, *b4, *b5;
     b0   = (unsigned long long*) malloc(HIST_SIZE * 6 * sizeof(unsigned long long));