mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-21 20:15:17 +00:00
replace g_new() with g_new0() for consistency
g_new() is used in only 3 places. Switching them to g_new0() will do no harm, reduces confusion, and helps me sleep better at night knowing that all allocated memory is initialized to 0 :-) (Yes, I *know* that in all three cases the associated memory is immediately assigned some other value. Today.) Signed-off-by: Laine Stump <laine@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
588d2834d7
commit
cc5da62bbd
@ -65,7 +65,7 @@ qemuBackupPrepare(virDomainBackupDefPtr def)
|
||||
|
||||
if (def->type == VIR_DOMAIN_BACKUP_TYPE_PULL) {
|
||||
if (!def->server) {
|
||||
def->server = g_new(virStorageNetHostDef, 1);
|
||||
def->server = g_new0(virStorageNetHostDef, 1);
|
||||
|
||||
def->server->transport = VIR_STORAGE_NET_HOST_TRANS_TCP;
|
||||
def->server->name = g_strdup("localhost");
|
||||
|
@ -962,7 +962,7 @@ virGetGroupList(uid_t uid, gid_t gid, gid_t **list)
|
||||
if (uid != (uid_t)-1 &&
|
||||
virGetUserEnt(uid, &user, &primary, NULL, NULL, true) >= 0) {
|
||||
int nallocgrps = 10;
|
||||
gid_t *grps = g_new(gid_t, nallocgrps);
|
||||
gid_t *grps = g_new0(gid_t, nallocgrps);
|
||||
|
||||
while (1) {
|
||||
int nprevallocgrps = nallocgrps;
|
||||
|
@ -57,7 +57,7 @@ virDevMapperGetTargets(const char *path,
|
||||
*devPaths = NULL;
|
||||
|
||||
if (STREQ(path, "/dev/mapper/virt")) {
|
||||
*devPaths = g_new(char *, 4);
|
||||
*devPaths = g_new0(char *, 4);
|
||||
(*devPaths)[0] = g_strdup("/dev/block/8:0"); /* /dev/sda */
|
||||
(*devPaths)[1] = g_strdup("/dev/block/8:16"); /* /dev/sdb */
|
||||
(*devPaths)[2] = g_strdup("/dev/block/8:32"); /* /dev/sdc */
|
||||
|
Loading…
x
Reference in New Issue
Block a user