mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-14 05:57:26 +03:00
util: systemd: use g_new0
Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
parent
1022e0eeb4
commit
3af4ab98e0
@ -364,8 +364,7 @@ int virSystemdCreateMachine(const char *name,
|
|||||||
if (g_atomic_int_get(&hasCreateWithNetwork)) {
|
if (g_atomic_int_get(&hasCreateWithNetwork)) {
|
||||||
g_autoptr(virError) error = NULL;
|
g_autoptr(virError) error = NULL;
|
||||||
|
|
||||||
if (VIR_ALLOC(error) < 0)
|
error = g_new0(virError, 1);
|
||||||
return -1;
|
|
||||||
|
|
||||||
guuid = g_variant_new_fixed_array(G_VARIANT_TYPE("y"),
|
guuid = g_variant_new_fixed_array(G_VARIANT_TYPE("y"),
|
||||||
uuid, 16, sizeof(unsigned char));
|
uuid, 16, sizeof(unsigned char));
|
||||||
@ -495,8 +494,7 @@ int virSystemdTerminateMachine(const char *name)
|
|||||||
if (!(conn = virGDBusGetSystemBus()))
|
if (!(conn = virGDBusGetSystemBus()))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (VIR_ALLOC(error) < 0)
|
error = g_new0(virError, 1);
|
||||||
return -1;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The systemd DBus API we're invoking has the
|
* The systemd DBus API we're invoking has the
|
||||||
@ -655,14 +653,8 @@ virSystemdActivationAddFD(virSystemdActivationPtr act,
|
|||||||
virSystemdActivationEntryPtr ent = virHashLookup(act->fds, name);
|
virSystemdActivationEntryPtr ent = virHashLookup(act->fds, name);
|
||||||
|
|
||||||
if (!ent) {
|
if (!ent) {
|
||||||
if (VIR_ALLOC(ent) < 0)
|
ent = g_new0(virSystemdActivationEntry, 1);
|
||||||
return -1;
|
ent->fds = g_new0(int, 1);
|
||||||
|
|
||||||
if (VIR_ALLOC_N(ent->fds, 1) < 0) {
|
|
||||||
virSystemdActivationEntryFree(ent);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
ent->fds[ent->nfds++] = fd;
|
ent->fds[ent->nfds++] = fd;
|
||||||
|
|
||||||
VIR_DEBUG("Record first FD %d with name %s", fd, name);
|
VIR_DEBUG("Record first FD %d with name %s", fd, name);
|
||||||
@ -902,8 +894,7 @@ virSystemdActivationNew(virSystemdActivationMap *map,
|
|||||||
const char *fdnames;
|
const char *fdnames;
|
||||||
|
|
||||||
VIR_DEBUG("Activated with %d FDs", nfds);
|
VIR_DEBUG("Activated with %d FDs", nfds);
|
||||||
if (VIR_ALLOC(act) < 0)
|
act = g_new0(virSystemdActivation, 1);
|
||||||
return NULL;
|
|
||||||
|
|
||||||
if (!(act->fds = virHashCreate(10, virSystemdActivationEntryFree)))
|
if (!(act->fds = virHashCreate(10, virSystemdActivationEntryFree)))
|
||||||
goto error;
|
goto error;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user