Index: cfe/trunk/lib/StaticAnalyzer/Core/PathDiagnostic.cpp =================================================================== --- cfe/trunk/lib/StaticAnalyzer/Core/PathDiagnostic.cpp +++ cfe/trunk/lib/StaticAnalyzer/Core/PathDiagnostic.cpp @@ -1211,6 +1211,9 @@ // Check if the parameter is a pointer to the symbol. if (Optional Reg = SV.getAs()) { + // Do not attempt to dereference void*. + if ((*I)->getType()->isVoidPointerType()) + continue; SVal PSV = N->getState()->getSVal(Reg->getRegion()); SymbolRef AS = PSV.getAsLocSymbol(); if (AS == Sym) { Index: cfe/trunk/test/Analysis/malloc.c =================================================================== --- cfe/trunk/test/Analysis/malloc.c +++ cfe/trunk/test/Analysis/malloc.c @@ -1786,6 +1786,18 @@ free(p); } +void allocateSomeMemory(void *offendingParameter, void **ptr) { + *ptr = malloc(1); +} + +void testNoCrashOnOffendingParameter() { + // "extern" is necessary to avoid unrelated warnings + // on passing uninitialized value. + extern void *offendingParameter; + void* ptr; + allocateSomeMemory(offendingParameter, &ptr); +} // expected-warning {{Potential leak of memory pointed to by 'ptr'}} + // ---------------------------------------------------------------------------- // False negatives.