+2013-08-13 Nicolas François <nicolas.francois@centraliens.net>
+
+ * lib/groupmem.c: Add splint annotations. The added memset makes
+ splint think data was allocated.
+ * lib/pwmem.c: Likewise.
+ * lib/sgroupio.c: Likewise.
+ * lib/shadowmem.c: Likewise.
+
2013-08-13 Nicolas François <nicolas.francois@centraliens.net>
* man/login.defs.d/SUB_GID_COUNT.xml: Document that the behavior
* Copyright (c) 1996 - 2000, Marek Michałkiewicz
* Copyright (c) 2001 , Michał Moskal
* Copyright (c) 2005 , Tomasz Kłoczko
- * Copyright (c) 2007 - 2010, Nicolas François
+ * Copyright (c) 2007 - 2013, Nicolas François
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
/* The libc might define other fields. They won't be copied. */
memset (gr, 0, sizeof *gr);
gr->gr_gid = grent->gr_gid;
+ /*@-mustfreeonly@*/
gr->gr_name = strdup (grent->gr_name);
+ /*@=mustfreeonly@*/
if (NULL == gr->gr_name) {
free(gr);
return NULL;
}
+ /*@-mustfreeonly@*/
gr->gr_passwd = strdup (grent->gr_passwd);
+ /*@=mustfreeonly@*/
if (NULL == gr->gr_passwd) {
free(gr->gr_name);
free(gr);
for (i = 0; grent->gr_mem[i]; i++);
+ /*@-mustfreeonly@*/
gr->gr_mem = (char **) malloc ((i + 1) * sizeof (char *));
+ /*@=mustfreeonly@*/
if (NULL == gr->gr_mem) {
free(gr->gr_passwd);
free(gr->gr_name);
* Copyright (c) 1996 - 2000, Marek Michałkiewicz
* Copyright (c) 2001 , Michał Moskal
* Copyright (c) 2003 - 2005, Tomasz Kłoczko
- * Copyright (c) 2007 - 2009, Nicolas François
+ * Copyright (c) 2007 - 2013, Nicolas François
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
memset (pw, 0, sizeof *pw);
pw->pw_uid = pwent->pw_uid;
pw->pw_gid = pwent->pw_gid;
+ /*@-mustfreeonly@*/
pw->pw_name = strdup (pwent->pw_name);
+ /*@=mustfreeonly@*/
if (NULL == pw->pw_name) {
free(pw);
return NULL;
}
+ /*@-mustfreeonly@*/
pw->pw_passwd = strdup (pwent->pw_passwd);
+ /*@=mustfreeonly@*/
if (NULL == pw->pw_passwd) {
free(pw->pw_name);
free(pw);
return NULL;
}
+ /*@-mustfreeonly@*/
pw->pw_gecos = strdup (pwent->pw_gecos);
+ /*@=mustfreeonly@*/
if (NULL == pw->pw_gecos) {
free(pw->pw_passwd);
free(pw->pw_name);
free(pw);
return NULL;
}
+ /*@-mustfreeonly@*/
pw->pw_dir = strdup (pwent->pw_dir);
+ /*@=mustfreeonly@*/
if (NULL == pw->pw_dir) {
free(pw->pw_gecos);
free(pw->pw_passwd);
free(pw);
return NULL;
}
+ /*@-mustfreeonly@*/
pw->pw_shell = strdup (pwent->pw_shell);
+ /*@=mustfreeonly@*/
if (NULL == pw->pw_shell) {
free(pw->pw_dir);
free(pw->pw_gecos);
* Copyright (c) 1996 - 2000, Marek Michałkiewicz
* Copyright (c) 2001 , Michał Moskal
* Copyright (c) 2005 , Tomasz Kłoczko
- * Copyright (c) 2007 - 2008, Nicolas François
+ * Copyright (c) 2007 - 2013, Nicolas François
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
/* Do the same as the other _dup function, even if we know the
* structure. */
memset (sg, 0, sizeof *sg);
+ /*@-mustfreeonly@*/
sg->sg_name = strdup (sgent->sg_name);
+ /*@=mustfreeonly@*/
if (NULL == sg->sg_name) {
free (sg);
return NULL;
}
+ /*@-mustfreeonly@*/
sg->sg_passwd = strdup (sgent->sg_passwd);
+ /*@=mustfreeonly@*/
if (NULL == sg->sg_passwd) {
free (sg->sg_name);
free (sg);
}
for (i = 0; NULL != sgent->sg_adm[i]; i++);
+ /*@-mustfreeonly@*/
sg->sg_adm = (char **) malloc ((i + 1) * sizeof (char *));
+ /*@=mustfreeonly@*/
if (NULL == sg->sg_adm) {
free (sg->sg_passwd);
free (sg->sg_name);
sg->sg_adm[i] = NULL;
for (i = 0; NULL != sgent->sg_mem[i]; i++);
+ /*@-mustfreeonly@*/
sg->sg_mem = (char **) malloc ((i + 1) * sizeof (char *));
+ /*@=mustfreeonly@*/
if (NULL == sg->sg_mem) {
for (i = 0; NULL != sg->sg_adm[i]; i++) {
free (sg->sg_adm[i]);
* Copyright (c) 1996 - 2000, Marek Michałkiewicz
* Copyright (c) 2001 , Michał Moskal
* Copyright (c) 2005 , Tomasz Kłoczko
- * Copyright (c) 2007 - 2009, Nicolas François
+ * Copyright (c) 2007 - 2013, Nicolas François
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
sp->sp_inact = spent->sp_inact;
sp->sp_expire = spent->sp_expire;
sp->sp_flag = spent->sp_flag;
+ /*@-mustfreeonly@*/
sp->sp_namp = strdup (spent->sp_namp);
+ /*@=mustfreeonly@*/
if (NULL == sp->sp_namp) {
free(sp);
return NULL;
}
+ /*@-mustfreeonly@*/
sp->sp_pwdp = strdup (spent->sp_pwdp);
+ /*@=mustfreeonly@*/
if (NULL == sp->sp_pwdp) {
free(sp->sp_namp);
free(sp);