malloc(3) already sets errno to ENOMEM
Signed-off-by: Alejandro Colomar <alx@kernel.org>
This commit is contained in:
parent
0e1d017993
commit
56e4842db0
@ -313,7 +313,6 @@ static /*@null@*/struct commonio_entry *merge_group_entries (
|
|||||||
new_line_len = strlen (gr1->line) + strlen (gr2->line) +1;
|
new_line_len = strlen (gr1->line) + strlen (gr2->line) +1;
|
||||||
new_line = (char *)malloc (new_line_len + 1);
|
new_line = (char *)malloc (new_line_len + 1);
|
||||||
if (NULL == new_line) {
|
if (NULL == new_line) {
|
||||||
errno = ENOMEM;
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
snprintf(new_line, new_line_len + 1, "%s\n%s", gr1->line, gr2->line);
|
snprintf(new_line, new_line_len + 1, "%s\n%s", gr1->line, gr2->line);
|
||||||
@ -336,7 +335,6 @@ static /*@null@*/struct commonio_entry *merge_group_entries (
|
|||||||
new_members = (char **)calloc ( (members+1), sizeof(char*) );
|
new_members = (char **)calloc ( (members+1), sizeof(char*) );
|
||||||
if (NULL == new_members) {
|
if (NULL == new_members) {
|
||||||
free (new_line);
|
free (new_line);
|
||||||
errno = ENOMEM;
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
for (i=0; NULL != gptr1->gr_mem[i]; i++) {
|
for (i=0; NULL != gptr1->gr_mem[i]; i++) {
|
||||||
@ -397,7 +395,6 @@ static int split_groups (unsigned int max_members)
|
|||||||
|
|
||||||
new = (struct commonio_entry *) malloc (sizeof *new);
|
new = (struct commonio_entry *) malloc (sizeof *new);
|
||||||
if (NULL == new) {
|
if (NULL == new) {
|
||||||
errno = ENOMEM;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
new->eptr = group_dup(gr->eptr);
|
new->eptr = group_dup(gr->eptr);
|
||||||
|
Loading…
Reference in New Issue
Block a user