realloc may return NULL
- Ngôn ngữ chính
- C
- Star
- 5.6k
- Fork
- 510
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
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`.
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Đánh giá
Issue này chưa được đánh giá.