Fix small memleaks in nis_passwd() and nis_group().
These only occur upon error. Code Review: https://reviews.freebsd.org/D1849 Reviewed by: delphij CID: 1016715 CID: 1016717
This commit is contained in:
parent
b6c8f26052
commit
a69a20fa13
@ -1173,8 +1173,10 @@ nis_group(void *retval, void *mdata, va_list ap)
|
||||
* terminator, alignment padding, and one (char *)
|
||||
* pointer for the member list terminator.
|
||||
*/
|
||||
if (resultlen >= bufsize - _ALIGNBYTES - sizeof(char *))
|
||||
if (resultlen >= bufsize - _ALIGNBYTES - sizeof(char *)) {
|
||||
free(result);
|
||||
goto erange;
|
||||
}
|
||||
memcpy(buffer, result, resultlen);
|
||||
buffer[resultlen] = '\0';
|
||||
free(result);
|
||||
|
@ -1392,8 +1392,10 @@ nis_passwd(void *retval, void *mdata, va_list ap)
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (resultlen >= bufsize)
|
||||
if (resultlen >= bufsize) {
|
||||
free(result);
|
||||
goto erange;
|
||||
}
|
||||
memcpy(buffer, result, resultlen);
|
||||
buffer[resultlen] = '\0';
|
||||
free(result);
|
||||
|
Loading…
Reference in New Issue
Block a user