virDomainInfo info;
virDomainPtr dom;
virSecurityModel secmodel;
- virSecurityLabel seclabel;
+ virSecurityLabelPtr seclabel;
int persistent = 0;
int ret = TRUE, autostart;
unsigned int id;
vshPrint(ctl, "%-15s %s\n", _("Security DOI:"), secmodel.doi);
/* Security labels are only valid for active domains */
- memset(&seclabel, 0, sizeof seclabel);
- if (virDomainGetSecurityLabel(dom, &seclabel) == -1) {
+ if (VIR_ALLOC(seclabel) < 0) {
virDomainFree(dom);
return FALSE;
+ }
+
+ if (virDomainGetSecurityLabel(dom, seclabel) == -1) {
+ virDomainFree(dom);
+ VIR_FREE(seclabel);
+ return FALSE;
} else {
- if (seclabel.label[0] != '\0')
+ if (seclabel->label[0] != '\0')
vshPrint(ctl, "%-15s %s (%s)\n", _("Security label:"),
- seclabel.label, seclabel.enforcing ? "enforcing" : "permissive");
+ seclabel->label, seclabel->enforcing ? "enforcing" : "permissive");
}
+
+ VIR_FREE(seclabel);
}
}
virDomainFree(dom);
static void
vshOutputLogFile(vshControl *ctl, int log_level, const char *msg_format, va_list ap)
{
- char msg_buf[MSG_BUFFER];
+ char *msg_buf;
const char *lvl = "";
struct timeval stTimeval;
struct tm *stTm;
if (ctl->log_fd == -1)
return;
+ msg_buf = vshMalloc(ctl, MSG_BUFFER);
+
/**
* create log format
*
vshCloseLogFile(ctl);
vshError(ctl, "%s", _("failed to write the log file"));
}
+
+ VIR_FREE(msg_buf);
}
/**