Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memleak in sds.c:40 #87

Open
vkazanov opened this issue Jan 19, 2018 · 0 comments
Open

Memleak in sds.c:40 #87

vkazanov opened this issue Jan 19, 2018 · 0 comments

Comments

@vkazanov
Copy link

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

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:

char** new_vector = s_realloc(vector,((*argc)+1)*sizeof(char*));
if (new_vector == NULL) goto err;
vector = new_vector;
vector[*argc] = current;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant