diskfilter_make_raid: more memory leaks in failure path
This commit is contained in:
parent
2ae9457e6e
commit
8f5ebb1245
1 changed files with 11 additions and 2 deletions
|
@ -1031,7 +1031,10 @@ grub_diskfilter_make_raid (grub_size_t uuidlen, char *uuid, int nmemb,
|
||||||
if (n == 1)
|
if (n == 1)
|
||||||
n = (layout >> 8) & 0xFF;
|
n = (layout >> 8) & 0xFF;
|
||||||
if (n == 0)
|
if (n == 0)
|
||||||
return NULL;
|
{
|
||||||
|
grub_free (uuid);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
totsize = grub_divmod64 (nmemb * disk_size, n, 0);
|
totsize = grub_divmod64 (nmemb * disk_size, n, 0);
|
||||||
}
|
}
|
||||||
|
@ -1045,6 +1048,7 @@ grub_diskfilter_make_raid (grub_size_t uuidlen, char *uuid, int nmemb,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
grub_free (uuid);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1067,7 +1071,10 @@ grub_diskfilter_make_raid (grub_size_t uuidlen, char *uuid, int nmemb,
|
||||||
}
|
}
|
||||||
array = grub_zalloc (sizeof (*array));
|
array = grub_zalloc (sizeof (*array));
|
||||||
if (!array)
|
if (!array)
|
||||||
return NULL;
|
{
|
||||||
|
grub_free (uuid);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
array->uuid = uuid;
|
array->uuid = uuid;
|
||||||
array->uuid_len = uuidlen;
|
array->uuid_len = uuidlen;
|
||||||
if (name)
|
if (name)
|
||||||
|
@ -1166,6 +1173,8 @@ grub_diskfilter_make_raid (grub_size_t uuidlen, char *uuid, int nmemb,
|
||||||
grub_free (array->pvs);
|
grub_free (array->pvs);
|
||||||
array->pvs = pv;
|
array->pvs = pv;
|
||||||
}
|
}
|
||||||
|
grub_free (array->name);
|
||||||
|
grub_free (array->uuid);
|
||||||
grub_free (array);
|
grub_free (array);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue