mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-18 10:35:55 +00:00
Fix double free().
Reported by: Coverity Coverity CID: 1130048
This commit is contained in:
parent
84dfba8d18
commit
a9554102f9
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=258594
@ -683,10 +683,8 @@ nvpair_unpack(int flags, const unsigned char *ptr, size_t *leftp,
|
||||
if (ptr == NULL)
|
||||
goto failed;
|
||||
tmp = realloc(nvp, sizeof(*nvp) + strlen(nvp->nvp_name) + 1);
|
||||
if (tmp == NULL) {
|
||||
free(nvp);
|
||||
if (tmp == NULL)
|
||||
goto failed;
|
||||
}
|
||||
nvp = tmp;
|
||||
/* Update nvp_name after realloc(). */
|
||||
nvp->nvp_name = (char *)(nvp + 1);
|
||||
|
Loading…
Reference in New Issue
Block a user