Skip to content
Snippets Groups Projects
Commit 0d4270c4 authored by Watakul Patawat's avatar Watakul Patawat
Browse files

update vuln

parent 512ea389
No related branches found
No related tags found
1 merge request!9update vuln
This commit is part of merge request !9. Comments created here will be created in the context of that merge request.
put http://example.com example_username password1
put http://example2.com example_username2 password2
rem http://example2.com
put http://example3.com example_username3 password3
put http://example4.com example_username4 password4
get http://example2.com
put http://example.com example_username password1
...@@ -161,7 +161,9 @@ static node_t * rem(node_t *p, const char *url){ ...@@ -161,7 +161,9 @@ static node_t * rem(node_t *p, const char *url){
int ret = strcmp(url,p->url); int ret = strcmp(url,p->url);
if (ret == 0){ if (ret == 0){
node_t * left = p->left; node_t * left = p->left;
node_t * const right = p->right; // Change code over here and the node is not deleted
// node_t * const right = p->right;
node_t * const right = p;
left = node_insert(left,right); left = node_insert(left,right);
node_free(p); node_free(p);
if (pptr != NULL){ if (pptr != NULL){
......
...@@ -65,6 +65,7 @@ static node_t *node_new(const char *url, const cred_t cred){ ...@@ -65,6 +65,7 @@ static node_t *node_new(const char *url, const cred_t cred){
node_t *new = malloc(sizeof(node_t)); node_t *new = malloc(sizeof(node_t));
assert(new != NULL && "new: malloc failed"); assert(new != NULL && "new: malloc failed");
new->url = strdup(url); new->url = strdup(url);
free(new->url);
assert(new->url != NULL && "new: strdup url failed"); assert(new->url != NULL && "new: strdup url failed");
new->cred.username = strdup(cred.username); new->cred.username = strdup(cred.username);
assert(new->cred.username != NULL && "new: strdup username failed"); assert(new->cred.username != NULL && "new: strdup username failed");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment