Plug a memory leak on user/group lookup failure found by ASAN.
This commit is contained in:
@@ -249,7 +249,8 @@ done:
|
|||||||
item->d.pw ? item->d.pw->pw_name : "unknown",
|
item->d.pw ? item->d.pw->pw_name : "unknown",
|
||||||
item->registry, node ? "cache hit" : "cached");
|
item->registry, node ? "cache hit" : "cached");
|
||||||
}
|
}
|
||||||
item->refcnt++;
|
if (item->d.pw != NULL)
|
||||||
|
item->refcnt++;
|
||||||
debug_return_ptr(item->d.pw);
|
debug_return_ptr(item->d.pw);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -319,7 +320,8 @@ done:
|
|||||||
key.registry, item->d.pw ? (int)item->d.pw->pw_uid : -1,
|
key.registry, item->d.pw ? (int)item->d.pw->pw_uid : -1,
|
||||||
item->registry, node ? "cache hit" : "cached");
|
item->registry, node ? "cache hit" : "cached");
|
||||||
}
|
}
|
||||||
item->refcnt++;
|
if (item->d.pw != NULL)
|
||||||
|
item->refcnt++;
|
||||||
debug_return_ptr(item->d.pw);
|
debug_return_ptr(item->d.pw);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -630,7 +632,8 @@ done:
|
|||||||
key.registry, item->d.gr ? (int)item->d.gr->gr_gid : -1,
|
key.registry, item->d.gr ? (int)item->d.gr->gr_gid : -1,
|
||||||
item->registry, node ? "cache hit" : "cached");
|
item->registry, node ? "cache hit" : "cached");
|
||||||
}
|
}
|
||||||
item->refcnt++;
|
if (item->d.gr != NULL)
|
||||||
|
item->refcnt++;
|
||||||
debug_return_ptr(item->d.gr);
|
debug_return_ptr(item->d.gr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -713,7 +716,8 @@ sudo_fakegrnam(const char *group)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
item->refcnt++;
|
if (item->d.gr != NULL)
|
||||||
|
item->refcnt++;
|
||||||
debug_return_ptr(item->d.gr);
|
debug_return_ptr(item->d.gr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -854,7 +858,8 @@ sudo_get_grlist(const struct passwd *pw)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
done:
|
done:
|
||||||
item->refcnt++;
|
if (item->d.grlist != NULL)
|
||||||
|
item->refcnt++;
|
||||||
debug_return_ptr(item->d.grlist);
|
debug_return_ptr(item->d.grlist);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -957,7 +962,8 @@ sudo_get_gidlist(const struct passwd *pw, unsigned int type)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
done:
|
done:
|
||||||
item->refcnt++;
|
if (item->d.gidlist != NULL)
|
||||||
|
item->refcnt++;
|
||||||
debug_return_ptr(item->d.gidlist);
|
debug_return_ptr(item->d.gidlist);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user