Пожалуйста, включите JavaScript.
Главная
Обзор
Помощь
Вход
piumarta
/
subc
Следить
1
В избранное
0
Форкнуть
0
Код
Задачи
0
Pull Request'ы
0
Релизы
0
Вики
Активность
Просмотр исходного кода
handle malloc(), free(), casts and assignments involving pointers to variables, memory, or cast from integer constants
master
Ian Piumarta
3 месяцев назад
Родитель
3c5913ff9a
Сommit
dda40ae951
5 измененных файлов
:
1422 добавлений
и
1258 удалений
Разделённый вид
Опции Diff
Показать статистику
Скачать Patch файл
Скачать Diff файл
+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
Разница между файлами не показана из-за своего большого размера
Просмотреть файл
Редактирование
Предпросмотр
Загрузка…
Отмена
Сохранить