Skip to content

Commit bb240ca

Browse files
committed
Capitalization.
1 parent 96d6f22 commit bb240ca

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

modules/dynamic-allocation.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ See `man malloc` for more memory allocation related functions.
4646
The C runtime does not have a garbage collector so all heap allocated memory
4747
has to be explicitly freed via `free`() after it is no longer needed.
4848

49-
:wrench: write a program that takes at least 2 arguments. First argument
49+
:wrench: Write a program that takes at least 2 arguments. First argument
5050
specifies a dimension of an array of `int`s, the rest are the `int`s to fill
5151
out the array. To allocate memory for the array, use `malloc`. When filling
5252
out the array, ignore extra arguments. If you have less arguments, use zero
@@ -55,7 +55,7 @@ a string to an integer, use `atoi` and assume numbers are correctly entered.
5555

5656
```
5757
./a.out 10 1 2 3 7 8 999 7 7 7 9 9 9 10 11
58-
1 2 3 7 8 999 7 7 7 9
58+
1 2 3 7 8 999 7 7 7 9
5959
```
6060

6161
#solution allocate-and-fill-out-array.c

modules/heap-memory-woes.md

+13-10
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,19 @@
22

33
## Correctness
44

5-
- use after free: read/write memory that is part of memory chunk that was free'd
6-
- *dangling pointer* is often the cause of this; e.g. a structure contains pointer
7-
to heap allocated memory which is freed at some point of time and the
8-
pointer is still used to access the memory afterwards. In the meantime some other part
9-
of the program could have allocated piece(s) of the free'd memory.
10-
- the way to detect/prevent this is to set the pointer to `NULL` after freeing it
11-
- double free: free already free'd buffer
12-
- can corrupt internal heap allocator structures if it does not
13-
track the state of memory chunks
14-
- use static/dynamic analysis and/or heap allocator with the ability to detect this
5+
- Use after free: read/write memory that is part of memory chunk that was free'd
6+
- *Dangling pointer* is often the cause of this; e.g. a structure contains a
7+
pointer to heap allocated memory which is freed at some point of time and
8+
the pointer is still used to access the memory afterwards, and expected data
9+
could be found in there, or not - in the meantime some other part of the
10+
program could have allocated piece(s) of the free'd memory.
11+
- The way to detect/prevent this is to set the pointer to `NULL` after freeing
12+
it.
13+
- Double free: free already free'd buffer
14+
- Can corrupt internal heap allocator structures if it does not track the
15+
state of memory chunks
16+
- Use static/dynamic analysis and/or heap allocator with the ability to detect
17+
this
1518

1619
#source use-after-free.c
1720

0 commit comments

Comments
 (0)