mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 19:45:21 +00:00
virsh: Remove two 4kb stack allocations
This commit is contained in:
parent
a16de3594f
commit
36deff0499
@ -2052,7 +2052,7 @@ cmdDominfo(vshControl *ctl, const vshCmd *cmd)
|
|||||||
virDomainInfo info;
|
virDomainInfo info;
|
||||||
virDomainPtr dom;
|
virDomainPtr dom;
|
||||||
virSecurityModel secmodel;
|
virSecurityModel secmodel;
|
||||||
virSecurityLabel seclabel;
|
virSecurityLabelPtr seclabel;
|
||||||
int persistent = 0;
|
int persistent = 0;
|
||||||
int ret = TRUE, autostart;
|
int ret = TRUE, autostart;
|
||||||
unsigned int id;
|
unsigned int id;
|
||||||
@ -2138,15 +2138,22 @@ cmdDominfo(vshControl *ctl, const vshCmd *cmd)
|
|||||||
vshPrint(ctl, "%-15s %s\n", _("Security DOI:"), secmodel.doi);
|
vshPrint(ctl, "%-15s %s\n", _("Security DOI:"), secmodel.doi);
|
||||||
|
|
||||||
/* Security labels are only valid for active domains */
|
/* Security labels are only valid for active domains */
|
||||||
memset(&seclabel, 0, sizeof seclabel);
|
if (VIR_ALLOC(seclabel) < 0) {
|
||||||
if (virDomainGetSecurityLabel(dom, &seclabel) == -1) {
|
|
||||||
virDomainFree(dom);
|
virDomainFree(dom);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
} else {
|
|
||||||
if (seclabel.label[0] != '\0')
|
|
||||||
vshPrint(ctl, "%-15s %s (%s)\n", _("Security label:"),
|
|
||||||
seclabel.label, seclabel.enforcing ? "enforcing" : "permissive");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (virDomainGetSecurityLabel(dom, seclabel) == -1) {
|
||||||
|
virDomainFree(dom);
|
||||||
|
VIR_FREE(seclabel);
|
||||||
|
return FALSE;
|
||||||
|
} else {
|
||||||
|
if (seclabel->label[0] != '\0')
|
||||||
|
vshPrint(ctl, "%-15s %s (%s)\n", _("Security label:"),
|
||||||
|
seclabel->label, seclabel->enforcing ? "enforcing" : "permissive");
|
||||||
|
}
|
||||||
|
|
||||||
|
VIR_FREE(seclabel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virDomainFree(dom);
|
virDomainFree(dom);
|
||||||
@ -12141,7 +12148,7 @@ vshOpenLogFile(vshControl *ctl)
|
|||||||
static void
|
static void
|
||||||
vshOutputLogFile(vshControl *ctl, int log_level, const char *msg_format, va_list ap)
|
vshOutputLogFile(vshControl *ctl, int log_level, const char *msg_format, va_list ap)
|
||||||
{
|
{
|
||||||
char msg_buf[MSG_BUFFER];
|
char *msg_buf;
|
||||||
const char *lvl = "";
|
const char *lvl = "";
|
||||||
struct timeval stTimeval;
|
struct timeval stTimeval;
|
||||||
struct tm *stTm;
|
struct tm *stTm;
|
||||||
@ -12149,6 +12156,8 @@ vshOutputLogFile(vshControl *ctl, int log_level, const char *msg_format, va_list
|
|||||||
if (ctl->log_fd == -1)
|
if (ctl->log_fd == -1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
msg_buf = vshMalloc(ctl, MSG_BUFFER);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* create log format
|
* create log format
|
||||||
*
|
*
|
||||||
@ -12199,6 +12208,8 @@ vshOutputLogFile(vshControl *ctl, int log_level, const char *msg_format, va_list
|
|||||||
vshCloseLogFile(ctl);
|
vshCloseLogFile(ctl);
|
||||||
vshError(ctl, "%s", _("failed to write the log file"));
|
vshError(ctl, "%s", _("failed to write the log file"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VIR_FREE(msg_buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user