Skip to content

Commit 11715c0

Browse files
authored
Apply suggestions from code review
1 parent 7a55743 commit 11715c0

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3157,7 +3157,7 @@ void MallocChecker::checkPreCall(const CallEvent &Call,
31573157
SVal ArgSVal = Call.getArgSVal(I);
31583158
if (isa<Loc>(ArgSVal)) {
31593159
SymbolRef Sym = ArgSVal.getAsSymbol(/*IncludeBaseRegions=*/true);
3160-
if (!Sym)
3160+
if (!Sym)
31613161
continue;
31623162
if (checkUseAfterFree(Sym, C, Call.getArgExpr(I)))
31633163
return;

clang/test/Analysis/malloc-checker-arg-uaf.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_analyze_cc1 -analyzer-checker=unix.Malloc -verify %s
1+
// RUN: %clang_analyze_cc1 -analyzer-checker=core,unix.Malloc -verify %s
22

33
#include "Inputs/system-header-simulator-for-malloc.h"
44

@@ -37,8 +37,8 @@ void test_nested_alloc() {
3737
}
3838

3939
void test_nested_field() {
40-
struct Obj *o = malloc(sizeof(struct Obj));
40+
struct Obj *o = (struct Obj *)malloc(sizeof(struct Obj));
4141
int *f = &o->field;
4242
free(o);
4343
use(f); // expected-warning{{Use of memory after it is freed}}
44-
}
44+
}

0 commit comments

Comments
 (0)