Add splint annotations.
* 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.
This commit is contained in:
@ -3,7 +3,7 @@
|
||||
* 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
|
||||
@ -51,12 +51,16 @@
|
||||
/* 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);
|
||||
@ -65,7 +69,9 @@
|
||||
|
||||
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);
|
||||
|
Reference in New Issue
Block a user