antirez / antirez/sds

Memleak in sds.c:40

未关闭
#87 0 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
C
星标
5.6k
派生
510
PR 合并指标
30 天内没有已合并 PR

描述

There's a possible memleak and NULL ptr usage in sds.c:40 in `sdssplitargs`:

```c
vector = s_realloc(vector,((*argc)+1)*sizeof(char*));
vector[*argc] = current;
```

Realloc here might return NULL and thus NULLify `vector` while losing the reference to original object. I believe something like the following should be done:
```c
char** new_vector = s_realloc(vector,((*argc)+1)*sizeof(char*));
if (new_vector == NULL) goto err;
vector = new_vector;
vector[*argc] = current;
```

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。