-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Open
Labels
clang:static analyzerenhancementImproving things as opposed to bug fixing, e.g. new or missing featureImproving things as opposed to bug fixing, e.g. new or missing feature
Description
// clang --analyze -Xanalyzer -analyzer-output=text
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
void leak(bool v1) {
void* v3 = malloc(1);
if (v3 != NULL) {
int v5 = 0; // <--- warning: Potential leak of memory pointed to by 'v3' [unix.Malloc]
if (v1) {
return; // <--- Expected warning location
}
}
return;
}
void leak2(bool v1) {
void* v3 = malloc(1);
if (v3 != NULL) {
if (v1) { // <--- warning: Potential leak of memory pointed to by 'v3' [unix.Malloc]
return; // <--- Expected warning location
}
}
return;
}
void caller() {
leak(1);
leak2(1);
return;
}Metadata
Metadata
Assignees
Labels
clang:static analyzerenhancementImproving things as opposed to bug fixing, e.g. new or missing featureImproving things as opposed to bug fixing, e.g. new or missing feature