mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
virtlockd: fix misc memory leaks and other bugs
Fix memory leaks, failure to restore umask and missing man page docs. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
parent
df34363d58
commit
c32d977e0f
@ -118,6 +118,7 @@ virLockDaemonFree(virLockDaemonPtr lockd)
|
|||||||
if (!lockd)
|
if (!lockd)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
virMutexDestroy(&lockd->lock);
|
||||||
virObjectUnref(lockd->dmn);
|
virObjectUnref(lockd->dmn);
|
||||||
virHashFree(lockd->lockspaces);
|
virHashFree(lockd->lockspaces);
|
||||||
virLockSpaceFree(lockd->defaultLockspace);
|
virLockSpaceFree(lockd->defaultLockspace);
|
||||||
@ -410,6 +411,7 @@ virLockDaemonUnixSocketPaths(bool privileged,
|
|||||||
|
|
||||||
old_umask = umask(077);
|
old_umask = umask(077);
|
||||||
if (virFileMakePath(rundir) < 0) {
|
if (virFileMakePath(rundir) < 0) {
|
||||||
|
VIR_FREE(rundir);
|
||||||
umask(old_umask);
|
umask(old_umask);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
@ -516,6 +518,7 @@ virLockDaemonSetupLogging(virLockDaemonConfigPtr config,
|
|||||||
|
|
||||||
old_umask = umask(077);
|
old_umask = umask(077);
|
||||||
if (virFileMakePath(logdir) < 0) {
|
if (virFileMakePath(logdir) < 0) {
|
||||||
|
VIR_FREE(logdir);
|
||||||
umask(old_umask);
|
umask(old_umask);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
@ -1187,7 +1190,7 @@ int main(int argc, char **argv) {
|
|||||||
int c;
|
int c;
|
||||||
char *tmp;
|
char *tmp;
|
||||||
|
|
||||||
c = getopt_long(argc, argv, "ldf:p:t:vVh", opts, &optidx);
|
c = getopt_long(argc, argv, "df:p:t:vVh", opts, &optidx);
|
||||||
|
|
||||||
if (c == -1)
|
if (c == -1)
|
||||||
break;
|
break;
|
||||||
@ -1321,6 +1324,7 @@ int main(int argc, char **argv) {
|
|||||||
VIR_ERROR(_("unable to create rundir %s: %s"), run_dir,
|
VIR_ERROR(_("unable to create rundir %s: %s"), run_dir,
|
||||||
virStrerror(errno, ebuf, sizeof(ebuf)));
|
virStrerror(errno, ebuf, sizeof(ebuf)));
|
||||||
ret = VIR_LOCK_DAEMON_ERR_RUNDIR;
|
ret = VIR_LOCK_DAEMON_ERR_RUNDIR;
|
||||||
|
umask(old_umask);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
umask(old_umask);
|
umask(old_umask);
|
||||||
|
@ -166,6 +166,7 @@ static char *virLockManagerLockDaemonPath(bool privileged)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VIR_FREE(rundir);
|
||||||
}
|
}
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@ virtlockd - libvirt lock management daemon
|
|||||||
|
|
||||||
=head1 SYNOPSIS
|
=head1 SYNOPSIS
|
||||||
|
|
||||||
B<virtlockd> [ -dv ] [ -f config_file ] [ -p pid_file ]
|
B<virtlockd> [ -dvV ] [ -t timeout] [ -f config_file ] [ -p pid_file ]
|
||||||
|
|
||||||
B<virtlockd> --version
|
B<virtlockd> --version
|
||||||
|
|
||||||
@ -38,6 +38,11 @@ Run as a daemon and write PID file.
|
|||||||
|
|
||||||
Use this configuration file, overriding the default value.
|
Use this configuration file, overriding the default value.
|
||||||
|
|
||||||
|
=item B<-t, --timeout> I<SECONDS>
|
||||||
|
|
||||||
|
Automatically shutdown after I<SECONDS> have elapsed with
|
||||||
|
no active client or lock.
|
||||||
|
|
||||||
=item B<-p, --pid-file> I<FILE>
|
=item B<-p, --pid-file> I<FILE>
|
||||||
|
|
||||||
Use this name for the PID file, overriding the default value.
|
Use this name for the PID file, overriding the default value.
|
||||||
|
Loading…
Reference in New Issue
Block a user