realloc may return NULL
- Lingua principale
- C
- Stelle
- 5.6k
- Fork
- 510
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
Hi @antirez,
according to the `man page`
```
realloc() returns a pointer to the newly allocated memory, which is
suitably aligned for any kind of variable and may be different from
ptr, or NULL if the request fails. If size was equal to 0, either NULL
or a pointer suitable to be passed to free() is returned. If realloc()
fails the original block is left untouched; it is not freed or moved.
```
in `sds.c` at line 717:
```
vector = realloc(vector, ((*argc)+1)*sizeof(char*));
```
if `realloc()` fails to allocate the requested memory, at line 718 it may get `segfault`.
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Valutazione
Questa issue non è ancora stata valutata.