fix errors flagged by clang static analyzer

builtin.c: bug - free of uninitialized jv
compile.c: missing assertion
jq_test.c: buggy logic / unreachable code
jv.c: missing assertion
jv_alloc.c: false positive - intentional read of uninitialized memory
jv_file.c: dead code
This commit is contained in:
David Tolnay authored and Nicolas Williams committed 2015-06-20 16:08:56 -05:00
1 parent 7811ef1e17
commit 4a316fbb5a
6 files changed
+12 -9

No files matched your search

+3
View File
@@ -169,8 +169,11 @@ void* jv_mem_realloc(void* p, size_t sz) {
#ifndef NDEBUG
volatile char jv_mem_uninitialised;
__attribute__((constructor)) void jv_mem_uninit_setup(){
// ignore warning that this reads uninitialized memory - that's the point!
#ifndef __clang_analyzer__
char* p = malloc(1);
jv_mem_uninitialised = *p;
free(p);
#endif
}
#endif