Strona działa najlepiej z włączonym JavaScript.
Strona główna
Odkrywaj
Pomoc
Zaloguj się
piumarta
/
subc
Obserwuj
1
Polub
0
Forkuj
0
Kod
Zgłoszenia
0
Oczekujące zmiany
0
Wydania
0
Wiki
Aktywność
Przeglądaj źródła
handle malloc(), free(), casts and assignments involving pointers to variables, memory, or cast from integer constants
master
Ian Piumarta
3 miesięcy temu
rodzic
3c5913ff9a
commit
dda40ae951
5 zmienionych plików
z
1422 dodań
i
1258 usunięć
Widok podzielony
Opcje porównania
Pokaż statystyki
Ściągnij plik aktualizacji
Ściągnij plik porównania
+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
Wyświetl plik
@ -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
Wyświetl plik
@ -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
Wyświetl plik
@ -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
Wyświetl plik
@ -1 +1,2 @@
extern
void
*
malloc
(
long
size
)
;
extern
void
free
(
void
*
pointer
)
;
+ 1414
- 1252
main.leg
Plik diff jest za duży
Wyświetl plik
Napisz
Podgląd
Ładowanie…
Anuluj
Zapisz