sanger-pathogens / snp-sites

Finds SNP sites from a multi-FASTA alignment file
http://sanger-pathogens.github.io/snp-sites/
Other
241 stars 50 forks source link

Running the clang static analyser turns up an issue with unintialised… #40

Closed AidanDelaney closed 8 years ago

AidanDelaney commented 8 years ago

… pointer in alignment-file.c

The clang analyser reports the following, which have now been addressed. I'm hoping to run some other analysers over the next few days.

$ scan-build gcc -c src/*.c -I . scan-build: Using '/usr/bin/clang' for static analysis src/alignment-file.c:126:15: warning: Potential leak of memory pointed to by 'first_sequence' for(i = 0; i < length_of_genome; i++) ^ src/alignment-file.c:134:10: warning: Dereference of undefined pointer value if(first_sequence[i] == 'N' && !is_unknown(seq->seq.s[i])) ^~~~~ src/alignment-file.c:160:10: warning: Dereference of undefined pointer value if(first_sequence[i] == '>') ^~~~~ src/alignment-file.c:166:3: warning: Function call argument is an uninitialized value free(first_sequence); ^~~~~~~~ 4 warnings generated. scan-build: 4 bugs found.