|
@@ -24,7 +24,7 @@
|
|
*
|
|
*
|
|
* @param [in] name User name.
|
|
* @param [in] name User name.
|
|
* @return Pointer to allocated passwd structure.
|
|
* @return Pointer to allocated passwd structure.
|
|
- * @warning The resulting pointer (return value) must be freed by free().
|
|
|
|
|
|
+ * @warning The resulting pointer (return value) must be freed by faux_free().
|
|
*/
|
|
*/
|
|
struct passwd *faux_sysdb_getpwnam(const char *name) {
|
|
struct passwd *faux_sysdb_getpwnam(const char *name) {
|
|
|
|
|
|
@@ -40,7 +40,7 @@ struct passwd *faux_sysdb_getpwnam(const char *name) {
|
|
#else
|
|
#else
|
|
size = DEFAULT_GETPW_R_SIZE_MAX;
|
|
size = DEFAULT_GETPW_R_SIZE_MAX;
|
|
#endif
|
|
#endif
|
|
- pwbuf = malloc(sizeof(*pwbuf) + size);
|
|
|
|
|
|
+ pwbuf = faux_zmalloc(sizeof(*pwbuf) + size);
|
|
if (!pwbuf)
|
|
if (!pwbuf)
|
|
return NULL;
|
|
return NULL;
|
|
buf = (char *)pwbuf + sizeof(*pwbuf);
|
|
buf = (char *)pwbuf + sizeof(*pwbuf);
|
|
@@ -48,7 +48,7 @@ struct passwd *faux_sysdb_getpwnam(const char *name) {
|
|
res = getpwnam_r(name, pwbuf, buf, size, &pw);
|
|
res = getpwnam_r(name, pwbuf, buf, size, &pw);
|
|
|
|
|
|
if (res || !pw) {
|
|
if (res || !pw) {
|
|
- free(pwbuf);
|
|
|
|
|
|
+ faux_free(pwbuf);
|
|
if (res != 0)
|
|
if (res != 0)
|
|
errno = res;
|
|
errno = res;
|
|
else
|
|
else
|
|
@@ -65,7 +65,7 @@ struct passwd *faux_sysdb_getpwnam(const char *name) {
|
|
*
|
|
*
|
|
* @param [in] uid UID.
|
|
* @param [in] uid UID.
|
|
* @return Pointer to allocated passwd structure.
|
|
* @return Pointer to allocated passwd structure.
|
|
- * @warning The resulting pointer (return value) must be freed by free().
|
|
|
|
|
|
+ * @warning The resulting pointer (return value) must be freed by faux_free().
|
|
*/
|
|
*/
|
|
struct passwd *faux_sysdb_getpwuid(uid_t uid) {
|
|
struct passwd *faux_sysdb_getpwuid(uid_t uid) {
|
|
|
|
|
|
@@ -81,7 +81,7 @@ struct passwd *faux_sysdb_getpwuid(uid_t uid) {
|
|
#else
|
|
#else
|
|
size = DEFAULT_GETPW_R_SIZE_MAX;
|
|
size = DEFAULT_GETPW_R_SIZE_MAX;
|
|
#endif
|
|
#endif
|
|
- pwbuf = malloc(sizeof(*pwbuf) + size);
|
|
|
|
|
|
+ pwbuf = faux_zmalloc(sizeof(*pwbuf) + size);
|
|
if (!pwbuf)
|
|
if (!pwbuf)
|
|
return NULL;
|
|
return NULL;
|
|
buf = (char *)pwbuf + sizeof(*pwbuf);
|
|
buf = (char *)pwbuf + sizeof(*pwbuf);
|
|
@@ -89,7 +89,7 @@ struct passwd *faux_sysdb_getpwuid(uid_t uid) {
|
|
res = getpwuid_r(uid, pwbuf, buf, size, &pw);
|
|
res = getpwuid_r(uid, pwbuf, buf, size, &pw);
|
|
|
|
|
|
if (NULL == pw) {
|
|
if (NULL == pw) {
|
|
- free(pwbuf);
|
|
|
|
|
|
+ faux_free(pwbuf);
|
|
if (res != 0)
|
|
if (res != 0)
|
|
errno = res;
|
|
errno = res;
|
|
else
|
|
else
|
|
@@ -106,7 +106,7 @@ struct passwd *faux_sysdb_getpwuid(uid_t uid) {
|
|
*
|
|
*
|
|
* @param [in] name Group name.
|
|
* @param [in] name Group name.
|
|
* @return Pointer to allocated group structure.
|
|
* @return Pointer to allocated group structure.
|
|
- * @warning The resulting pointer (return value) must be freed by free().
|
|
|
|
|
|
+ * @warning The resulting pointer (return value) must be freed by faux_free().
|
|
*/
|
|
*/
|
|
struct group *faux_sysdb_getgrnam(const char *name) {
|
|
struct group *faux_sysdb_getgrnam(const char *name) {
|
|
|
|
|
|
@@ -122,7 +122,7 @@ struct group *faux_sysdb_getgrnam(const char *name) {
|
|
#else
|
|
#else
|
|
size = DEFAULT_GETPW_R_SIZE_MAX;
|
|
size = DEFAULT_GETPW_R_SIZE_MAX;
|
|
#endif
|
|
#endif
|
|
- grbuf = malloc(sizeof(*grbuf) + size);
|
|
|
|
|
|
+ grbuf = faux_zmalloc(sizeof(*grbuf) + size);
|
|
if (!grbuf)
|
|
if (!grbuf)
|
|
return NULL;
|
|
return NULL;
|
|
buf = (char *)grbuf + sizeof(*grbuf);
|
|
buf = (char *)grbuf + sizeof(*grbuf);
|
|
@@ -130,7 +130,7 @@ struct group *faux_sysdb_getgrnam(const char *name) {
|
|
res = getgrnam_r(name, grbuf, buf, size, &gr);
|
|
res = getgrnam_r(name, grbuf, buf, size, &gr);
|
|
|
|
|
|
if (!gr) {
|
|
if (!gr) {
|
|
- free(grbuf);
|
|
|
|
|
|
+ faux_free(grbuf);
|
|
if (res != 0)
|
|
if (res != 0)
|
|
errno = res;
|
|
errno = res;
|
|
else
|
|
else
|
|
@@ -147,7 +147,7 @@ struct group *faux_sysdb_getgrnam(const char *name) {
|
|
*
|
|
*
|
|
* @param [in] gid GID.
|
|
* @param [in] gid GID.
|
|
* @return Pointer to allocated group structure.
|
|
* @return Pointer to allocated group structure.
|
|
- * @warning The resulting pointer (return value) must be freed by free().
|
|
|
|
|
|
+ * @warning The resulting pointer (return value) must be freed by faux_free().
|
|
*/
|
|
*/
|
|
struct group *faux_sysdb_getgrgid(gid_t gid) {
|
|
struct group *faux_sysdb_getgrgid(gid_t gid) {
|
|
|
|
|
|
@@ -163,7 +163,7 @@ struct group *faux_sysdb_getgrgid(gid_t gid) {
|
|
#else
|
|
#else
|
|
size = DEFAULT_GETPW_R_SIZE_MAX;
|
|
size = DEFAULT_GETPW_R_SIZE_MAX;
|
|
#endif
|
|
#endif
|
|
- grbuf = malloc(sizeof(struct group) + size);
|
|
|
|
|
|
+ grbuf = faux_zmalloc(sizeof(struct group) + size);
|
|
if (!grbuf)
|
|
if (!grbuf)
|
|
return NULL;
|
|
return NULL;
|
|
buf = (char *)grbuf + sizeof(struct group);
|
|
buf = (char *)grbuf + sizeof(struct group);
|
|
@@ -171,7 +171,7 @@ struct group *faux_sysdb_getgrgid(gid_t gid) {
|
|
res = getgrgid_r(gid, grbuf, buf, size, &gr);
|
|
res = getgrgid_r(gid, grbuf, buf, size, &gr);
|
|
|
|
|
|
if (!gr) {
|
|
if (!gr) {
|
|
- free(grbuf);
|
|
|
|
|
|
+ faux_free(grbuf);
|
|
if (res != 0)
|
|
if (res != 0)
|
|
errno = res;
|
|
errno = res;
|
|
else
|
|
else
|