ef9dd57d118f622f630b2d38bde182ee7a14316a
angie
  Wed Feb 27 12:22:22 2013 -0800
bugfix: forgot to null out *pList in a FreeList function.
diff --git src/lib/annoRow.c src/lib/annoRow.c
index cc26b26..98d3ae6 100644
--- src/lib/annoRow.c
+++ src/lib/annoRow.c
@@ -1,105 +1,106 @@
 /* annoRow -- basic data interchange unit of annoGratorQuery framework. */
 
 #include "annoRow.h"
 #include "annoStreamer.h"
 
 struct annoRow *annoRowFromStringArray(char *chrom, uint start, uint end, boolean rightJoinFail,
 				       char **wordsIn, int numCols)
 /* Allocate & return an annoRow with words cloned from wordsIn. */
 {
 struct annoRow *aRow;
 AllocVar(aRow);
 aRow->chrom = cloneString(chrom);
 aRow->start = start;
 aRow->end = end;
 aRow->rightJoinFail = rightJoinFail;
 char **words;
 AllocArray(words, numCols);
 int i;
 for (i = 0;  i < numCols;  i++)
     words[i] = cloneString(wordsIn[i]);
 aRow->data = words;
 return aRow;
 }
 
 struct annoRow *annoRowWigNew(char *chrom, uint start, uint end, boolean rightJoinFail,
 			      float *values)
 /* Allocate & return an annoRowWig, with clone of values; length of values is (end-start). */
 {
 struct annoRow *row;
 AllocVar(row);
 row->chrom = cloneString(chrom);
 row->start = start;
 row->end = end;
 row->data = cloneMem(values, (end - start) * sizeof(values[0]));
 row->rightJoinFail = rightJoinFail;
 return row;
 }
 
 struct annoRow *annoRowClone(struct annoRow *rowIn, struct annoStreamer *source)
 /* Allocate & return a single annoRow cloned from rowIn. */
 {
 if (rowIn == NULL)
     return NULL;
 if (source->rowType == arWords || source->rowType == arVcf)
     return annoRowFromStringArray(rowIn->chrom, rowIn->start, rowIn->end, rowIn->rightJoinFail,
 				  rowIn->data, source->numCols);
 else if (source->rowType == arWig)
     return annoRowWigNew(rowIn->chrom, rowIn->start, rowIn->end, rowIn->rightJoinFail,
 			 (float *)rowIn->data);
 else
     errAbort("annoRowClone: unrecognized type %d", source->rowType);
 return NULL;
 }
 
 static void annoRowWordsFree(struct annoRow **pRow, int numCols)
 /* Free a single annoRow with type arWords. */
 {
 if (pRow == NULL)
     return;
 struct annoRow *row = *pRow;
 freeMem(row->chrom);
 char **words = row->data;
 int i;
 for (i = 0;  i < numCols;  i++)
     freeMem(words[i]);
 freeMem(row->data);
 freez(pRow);
 }
 
 static void annoRowWigFree(struct annoRow **pRow)
 /* Free a single annoRow with type arWig. */
 {
 if (pRow == NULL)
     return;
 struct annoRow *row = *pRow;
 freeMem(row->chrom);
 freeMem(row->data);
 freez(pRow);
 }
 
 void annoRowFree(struct annoRow **pRow, struct annoStreamer *source)
 /* Free a single annoRow. */
 {
 if (pRow == NULL)
     return;
 if (source->rowType == arWords || source->rowType == arVcf)
     annoRowWordsFree(pRow, source->numCols);
 else if (source->rowType == arWig)
     annoRowWigFree(pRow);
 else
     errAbort("annoRowFree: unrecognized type %d", source->rowType);
 }
 
 void annoRowFreeList(struct annoRow **pList, struct annoStreamer *source)
 /* Free a list of annoRows. */
 {
 if (pList == NULL)
     return;
 struct annoRow *row, *nextRow;
 for (row = *pList;  row != NULL;  row = nextRow)
     {
     nextRow = row->next;
     annoRowFree(&row, source);
     }
+*pList = NULL;
 }