This website works better with JavaScript.
首頁
探索
說明
登入
piumarta
/
subc
關註
1
收藏
0
複製
0
程式碼
問題管理
0
合併請求
0
版本發佈
0
Wiki
Activity
瀏覽代碼
handle malloc(), free(), casts and assignments involving pointers to variables, memory, or cast from integer constants
master
Ian Piumarta
3 月之前
父節點
3c5913ff9a
當前提交
dda40ae951
共有
5 個文件被更改
,包括
1422 次插入
和
1258 次删除
分割檢視
Diff Options
Show Stats
Download Patch File
Download Diff File
+1
-0
demofiles/memory-leak.c
+3
-3
demofiles/multiple-free.c
+3
-3
demofiles/null-pointer.c
+1
-0
include/stdlib.h
+1414
-1252
main.leg
+ 1
- 0
demofiles/memory-leak.c
查看文件
@ -8,6 +8,7 @@ int main() {
for
(
int
i
=
0
;
i
<
10
;
+
+
i
)
{
int
*
ptr
=
malloc
(
sizeof
(
*
ptr
)
)
;
assert
(
ptr
!
=
0
)
;
printf
(
"
%p
\n
"
,
ptr
)
;
*
ptr
=
i
;
}
return
0
;
+ 3
- 3
demofiles/multiple-free.c
查看文件
@ -6,8 +6,8 @@
int
main
(
)
{
int
*
ptr
=
malloc
(
sizeof
(
*
ptr
)
)
;
assert
(
ptr
)
;
free
(
ptr
)
;
free
(
ptr
)
;
assert
(
ptr
!
=
0
)
;
free
(
ptr
)
;
printf
(
"
%p
\n
"
,
ptr
)
;
free
(
ptr
)
;
printf
(
"
%p
\n
"
,
ptr
)
;
return
0
;
}
+ 3
- 3
demofiles/null-pointer.c
查看文件
@ -3,7 +3,7 @@
#
include
<stdio.h>
int
main
(
)
{
char
*
ptr
=
NULL
;
printf
(
"
%s
\n
"
,
ptr
)
;
return
0
;
char
*
ptr
=
(
void
*
)
0
;
/
/
NULL
printf
(
"
%s
\n
"
,
ptr
)
;
return
0
;
}
+ 1
- 0
include/stdlib.h
查看文件
@ -1 +1,2 @@
extern
void
*
malloc
(
long
size
)
;
extern
void
free
(
void
*
pointer
)
;
+ 1414
- 1252
main.leg
文件差異過大導致無法顯示
查看文件
Write
Preview
Loading…
取消
儲存