## Previously in Programovanie
`error: function returns address of local variable`
```cpp
void* malloc(size_t size);
```
```cpp
NR OF MEMBERS * SIZE OF ONE MEMBER
```
```cpp
char* buf = (char*)malloc(sizeof(char) * length);
```
```cpp
void* calloc(size_t nmemb,
size_t size);
```
```cpp
void free(void* ptr);
```
A.........................
AB........................
ABC.......................
ABCD......................
ABCDE.....................
ABCDEF....................
ABCDEFG...................
ABCDEFGH..................
ABCDEFGHI.................
ABCDEFGHIJ................
ABCDEFGHIJK...............
ABCDEFGHIJKL..............
ABCDEFGHIJKLM.............
ABCDEFGHIJKLMN............
ABCDEFGHIJKLMNO...........
ABCDEFGHIJKLMNOP..........
ABCDEFGHIJKLMNOPQRSTUVWXYZ

```cpp
int main(int argc, char** argv);
```
```cpp
int main(int argc, char* argv[]);
```
## [CWE-415: Double Free](https://cwe.mitre.org/data/definitions/415.html)
The product calls `free()` twice on the same memory address, potentially leading to modification of unexpected memory locations.
## [CWE-416: Use After Free](https://cwe.mitre.org/data/definitions/416.html)
Referencing memory after it has been freed can cause a program to crash, use unexpected values, or execute code.