char *saveptr = NULL;
size_t i;
- struct guest_arch guest_archs[32];
+ struct guest_arch guest_archs[32] = { 0 };
int nr_guest_archs = 0;
- memset(guest_archs, 0, sizeof(guest_archs));
-
if ((ver_info = libxl_get_version_info(ctx)) == NULL) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Failed to get version info from libxenlight"));
struct msghdr msg = { 0 };
struct iovec iov[1];
int ret;
- char control[CMSG_SPACE(sizeof(int))];
+ char control[CMSG_SPACE(sizeof(int))] = { 0 };
struct cmsghdr *cmsg;
- memset(control, 0, sizeof(control));
-
iov[0].iov_base = (void *)data;
iov[0].iov_len = len;
const char *certFile)
{
gnutls_x509_crt_t cert = NULL;
- gnutls_x509_crt_t cacerts[MAX_CERTS];
+ gnutls_x509_crt_t cacerts[MAX_CERTS] = { 0 };
size_t ncacerts = 0;
size_t i;
int ret = -1;
- memset(cacerts, 0, sizeof(cacerts));
if ((access(certFile, R_OK) == 0) &&
!(cert = virNetTLSContextLoadCertFromFile(certFile, isServer)))
goto cleanup;
int fd;
int n;
virNetlinkHandle *nlhandle = NULL;
- struct pollfd fds[1];
+ struct pollfd fds[1] = { 0 };
struct nlmsghdr *nlmsg = nlmsg_hdr(nl_msg);
if (protocol >= MAX_LINKS) {
goto error;
}
- memset(fds, 0, sizeof(fds));
-
fds[0].fd = fd;
fds[0].events = POLLIN;
{
int r;
char hostname[HOST_NAME_MAX+1], *result = NULL;
- struct addrinfo hints, *info;
+ struct addrinfo hints = { 0 };
+ struct addrinfo *info;
r = gethostname(hostname, sizeof(hostname));
if (r == -1) {
* canonicalize the hostname by running it through getaddrinfo
*/
- memset(&hints, 0, sizeof(hints));
hints.ai_flags = AI_CANONNAME|AI_CANONIDN;
hints.ai_family = AF_UNSPEC;
r = getaddrinfo(hostname, NULL, &hints, &info);
char *vmx = NULL;
size_t i;
int sched_cpu_affinity_length;
- unsigned char zero[VIR_UUID_BUFLEN];
+ unsigned char zero[VIR_UUID_BUFLEN] = { 0 };
g_auto(virBuffer) buffer = VIR_BUFFER_INITIALIZER;
char *preliminaryDisplayName = NULL;
char *displayName = NULL;
return NULL;
}
- memset(zero, 0, VIR_UUID_BUFLEN);
-
if (def->virtType != VIR_DOMAIN_VIRT_VMWARE) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Expecting virt type to be '%1$s' but found '%2$s'"),
const libxl_version_info*,
libxl_ctx *, ctx)
{
- static libxl_version_info info;
-
- memset(&info, 0, sizeof(info));
+ static libxl_version_info info = { 0 };
/* silence gcc warning about unused function */
if (0)
{
const testGenericData *data = opaque;
virDomainXMLOption *xmlopt = data->xmlopt;
- qemuMonitorMigrationStats stats, expectedStats;
+ qemuMonitorMigrationStats stats;
+ qemuMonitorMigrationStats expectedStats = { 0 };
g_autofree char *error = NULL;
g_autoptr(qemuMonitorTest) test = NULL;
if (!(test = qemuMonitorTestNewSchema(xmlopt, data->schema)))
return -1;
- memset(&expectedStats, 0, sizeof(expectedStats));
-
expectedStats.status = QEMU_MONITOR_MIGRATION_STATUS_ACTIVE;
expectedStats.total_time = 47;
expectedStats.ram_total = 1611038720;
#define DO_TEST_PARSE_AND_FORMAT(addrstr, family, pass) \
do { \
- virSocketAddr addr; \
+ virSocketAddr addr = { 0 }; \
struct testParseData data = { &addr, addrstr, family, pass }; \
struct testFormatData data2 = { &addr, addrstr, pass }; \
- memset(&addr, 0, sizeof(addr)); \
if (virTestRun("Test parse " addrstr " family " #family, \
testParseHelper, &data) < 0) \
ret = -1; \
#define DO_TEST_PARSE_AND_CHECK_FORMAT(addrstr, addrformated, family, pass) \
do { \
- virSocketAddr addr; \
+ virSocketAddr addr = { 0 }; \
struct testParseData data = { &addr, addrstr, family, true}; \
struct testFormatData data2 = { &addr, addrformated, pass }; \
- memset(&addr, 0, sizeof(addr)); \
if (virTestRun("Test parse " addrstr " family " #family, \
testParseHelper, &data) < 0) \
ret = -1; \
void *mdata __attribute__((unused)),
va_list ap)
{
- struct addrinfo sentinel, *cur, *ai;
+ struct addrinfo sentinel = { 0 };
+ struct addrinfo *cur = &sentinel;
+ struct addrinfo *ai;
const char *name;
name = va_arg(ap, char *);
ai = va_arg(ap, struct addrinfo *);
- memset(&sentinel, 0, sizeof(sentinel));
- cur = &sentinel;
-
if ((ai->ai_family == AF_UNSPEC) || (ai->ai_family == AF_INET6))
aiforaf(name, AF_INET6, ai, &cur);
if ((ai->ai_family == AF_UNSPEC) || (ai->ai_family == AF_INET))
*inboundStr = NULL, *outboundStr = NULL, *alias = NULL;
const char *sourceModeStr = NULL;
int sourceMode = -1;
- virNetDevBandwidthRate inbound, outbound;
+ virNetDevBandwidthRate inbound = { 0 };
+ virNetDevBandwidthRate outbound = { 0 };
virDomainNetType typ;
int ret;
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
}
if (inboundStr) {
- memset(&inbound, 0, sizeof(inbound));
if (virshParseRateStr(ctl, inboundStr, &inbound) < 0)
return false;
if (!inbound.average && !inbound.floor) {
}
}
if (outboundStr) {
- memset(&outbound, 0, sizeof(outbound));
if (virshParseRateStr(ctl, outboundStr, &outbound) < 0)
return false;
if (outbound.average == 0) {
bool current = vshCommandOptBool(cmd, "current");
bool config = vshCommandOptBool(cmd, "config");
bool live = vshCommandOptBool(cmd, "live");
- virNetDevBandwidthRate inbound, outbound;
+ virNetDevBandwidthRate inbound = { 0 };
+ virNetDevBandwidthRate outbound = { 0 };
size_t i;
VSH_EXCLUSIVE_OPTIONS_VAR(current, live);
vshCommandOptStringReq(ctl, cmd, "outbound", &outboundStr) < 0)
goto cleanup;
- memset(&inbound, 0, sizeof(inbound));
- memset(&outbound, 0, sizeof(outbound));
-
if (inboundStr) {
if (virshParseRateStr(ctl, inboundStr, &inbound) < 0)
goto cleanup;