7f8cbd77c72c1f24031395bbbeaf701e60c01fee braney Fri Jul 21 15:56:07 2023 -0700 initialize some pointers to NULL and check if they're NULL before using them refs #31729 diff --git src/hg/hgTracks/cds.c src/hg/hgTracks/cds.c index e1d324a..47a2aed 100644 --- src/hg/hgTracks/cds.c +++ src/hg/hgTracks/cds.c @@ -962,35 +962,37 @@ #else return NULL; #endif } #ifndef GBROWSE static struct dnaSeq *maybeGetPcrResultSeq(struct linkedFeatures *lf) /* Return (if possible) the primer sequences concatenated with the * target sequence between where they match. */ { struct dnaSeq *seq = NULL; char *pslFileName, *primerFileName; struct targetDb *target; if (! pcrResultParseCart(database, cart, &pslFileName, &primerFileName, &target)) return NULL; -char *fPrimer, *rPrimer, *nonCompRPrimer; +char *fPrimer=NULL, *rPrimer=NULL, *nonCompRPrimer; char *primerKey = NULL; if (lf->original) primerKey = ((struct psl *)lf->original)->qName; pcrResultGetPrimers(primerFileName, &fPrimer, &rPrimer, primerKey); +if ((fPrimer == NULL) || (rPrimer == NULL)) + return NULL; int fPrimerSize = strlen(fPrimer); int rPrimerSize = strlen(rPrimer); // we need to reverse complement the sequence for the display, but we // don't want to when we do the lookup in the psl file nonCompRPrimer = cloneString(rPrimer); reverseComplement(rPrimer, rPrimerSize); if (lf->name && isNotEmpty(lf->name)) { struct psl *tpsl; char *words[3]; int wordCount = chopByChar(cloneString(lf->extra), '|', words, ArraySize(words)); if (wordCount != 3) errAbort("maybeGetPcrResultSeq: expected 3 |-sep'd words but got '%s'", (char *)lf->extra); char *displayName = words[0];