FaceBook/infer-Cプロジェクトの分析
10171 ワード
Hello world Make
コマンド#コマンド#
Cプロジェクトのルートディレクトリで
さいぶんせき
infer -i – make
または
コマンド#コマンド#
Cプロジェクトのルートディレクトリで
infer -- make
を実行58deMacBook-Pro:c_hello wuxian$ infer -- make
cc -c example.c
Starting analysis (Infer version v0.1.0)
Analysis done
1 file analyzed
example.c:22: error: NULL_DEREFERENCE
pointer max last assigned on line 21 could be null and is dereferenced at line 22, column 10
example.c:36: error: NULL_DEREFERENCE
pointer joe last assigned on line 35 could be null and is dereferenced by call to get_age() at line 36, column 10
example.c:45: error: RESOURCE_LEAK
resource acquired to fd by call to open() at line 41, column 12 is not released after line 45, column 5
example.c:51: error: MEMORY_LEAK
memory dynamically allocated to p by call to malloc() at line 51, column 14 is not reachable after line 51, column 3
example.c:57: error: MEMORY_LEAK
memory dynamically allocated to p by call to malloc() at line 56, column 14 is not reachable after line 57, column 3
さいぶんせき
infer -i – make
58deMacBook-Pro:c_hello wuxian$ infer -i -- make
make: Nothing to be done for `all'.
Starting analysis (Infer version v0.1.0)
Analysis done
1 file analyzed
example.c:22: error: NULL_DEREFERENCE
pointer max last assigned on line 21 could be null and is dereferenced at line 22, column 10
example.c:36: error: NULL_DEREFERENCE
pointer joe last assigned on line 35 could be null and is dereferenced by call to get_age() at line 36, column 10
example.c:45: error: RESOURCE_LEAK
resource acquired to fd by call to open() at line 41, column 12 is not released after line 45, column 5
example.c:51: error: MEMORY_LEAK
memory dynamically allocated to p by call to malloc() at line 51, column 14 is not reachable after line 51, column 3
example.c:57: error: MEMORY_LEAK
memory dynamically allocated to p by call to malloc() at line 56, column 14 is not reachable after line 57, column 3
または
infer -- make
の実行前にmake clean
を実行する58deMacBook-Pro:c_hello wuxian$ make clean
rm -rf example.o
58deMacBook-Pro:c_hello wuxian$ infer -- make
cc -c example.c
Starting analysis (Infer version v0.1.0)
Analysis done
1 file analyzed
example.c:22: error: NULL_DEREFERENCE
pointer max last assigned on line 21 could be null and is dereferenced at line 22, column 10
example.c:36: error: NULL_DEREFERENCE
pointer joe last assigned on line 35 could be null and is dereferenced by call to get_age() at line 36, column 10
example.c:45: error: RESOURCE_LEAK
resource acquired to fd by call to open() at line 41, column 12 is not released after line 45, column 5
example.c:51: error: MEMORY_LEAK
memory dynamically allocated to p by call to malloc() at line 51, column 14 is not reachable after line 51, column 3
example.c:57: error: MEMORY_LEAK
memory dynamically allocated to p by call to malloc() at line 56, column 14 is not reachable after line 57, column 3