fixed memory leaks in restconf evhtp module

This commit is contained in:
Olof hagsand 2020-08-22 18:02:08 +02:00
parent 6be4b18391
commit 2e23856676
4 changed files with 83 additions and 45 deletions

View file

@ -554,8 +554,8 @@ yang_parse_file(int fd,
len = BUFLEN; /* any number is fine */
if ((buf = malloc(len)) == NULL){
perror("pt_file malloc");
return NULL;
clicon_err(OE_XML, errno, "malloc");
goto done;
}
memset(buf, 0, len);
i = 0; /* position in buf */
@ -579,7 +579,7 @@ yang_parse_file(int fd,
if ((ymod = yang_parse_str(buf, name, yspec)) < 0)
goto done;
done:
if (buf)
if (buf != NULL)
free(buf);
return ymod; /* top-level (sub)module */
}