origenv++;
}
- if (VIR_ALLOC_N(newenv, n) < 0)
+ if (VIR_ALLOC_N_QUIET(newenv, n) < 0)
return EXIT_FAILURE;
origenv = environ;
sigaction(SIGPIPE, &sig_action, NULL);
- if (virAsprintf(&buf, "1\n%100000d\n", 2) < 0) {
- virReportOOMError();
+ if (virAsprintf(&buf, "1\n%100000d\n", 2) < 0)
goto cleanup;
- }
virCommandSetInputBuffer(cmd, buf);
if (virCommandRun(cmd, NULL) < 0) {
return EXIT_FAILURE;
virEventRegisterDefaultImpl();
- if (VIR_ALLOC(test) < 0) {
- virReportOOMError();
+ if (VIR_ALLOC(test) < 0)
goto cleanup;
- }
if (virMutexInit(&test->lock) < 0) {
printf("Unable to init mutex: %d\n", errno);
strlen(replace) +
strlen(eol) + 1;
- if (VIR_ALLOC_N(dataout, dataoutlen) < 0) {
- virReportOOMError();
+ if (VIR_ALLOC_N(dataout, dataoutlen) < 0)
return NULL;
- }
memcpy(dataout, datain, (eq - datain) + 1);
memcpy(dataout + (eq - datain) + 1,
replace, strlen(replace));
if (have < want) {
size_t need = want - have;
- if (VIR_EXPAND_N(test->outgoing, test->outgoingCapacity, need) < 0) {
- virReportOOMError();
+ if (VIR_EXPAND_N(test->outgoing, test->outgoingCapacity, need) < 0)
return -1;
- }
}
want -= 2;
qemuMonitorTestItemPtr item;
if (VIR_ALLOC(item) < 0)
- goto no_memory;
+ goto error;
if (VIR_STRDUP(item->command_name, command_name) < 0 ||
VIR_STRDUP(item->response, response) < 0)
virMutexLock(&test->lock);
if (VIR_EXPAND_N(test->items, test->nitems, 1) < 0) {
virMutexUnlock(&test->lock);
- goto no_memory;
+ goto error;
}
test->items[test->nitems - 1] = item;
return 0;
-no_memory:
- virReportOOMError();
error:
qemuMonitorTestItemFree(item);
return -1;
char *tmpdir_template = NULL;
if (VIR_ALLOC(test) < 0)
- goto no_memory;
+ goto error;
if (virMutexInit(&test->lock) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
tmpdir_template = NULL;
if (virAsprintf(&path, "%s/qemumonitorjsontest.sock", test->tmpdir) < 0)
- goto no_memory;
+ goto error;
test->json = json;
if (!(test->vm = virDomainObjNew(xmlopt)))
VIR_FREE(path);
return test;
-no_memory:
- virReportOOMError();
-
error:
VIR_FREE(tmpdir_template);
qemuMonitorTestFree(test);
char *tmp;
if (virAsprintf(&tmp, "%s/securityselinuxlabeldata%s",
- abs_builddir, *path) < 0) {
- virReportOOMError();
+ abs_builddir, *path) < 0)
return -1;
- }
VIR_FREE(*path);
*path = tmp;
*nfiles = 0;
if (virAsprintf(&path, "%s/securityselinuxlabeldata/%s.txt",
- abs_srcdir, testname) < 0) {
- virReportOOMError();
+ abs_srcdir, testname) < 0)
goto cleanup;
- }
if (!(fp = fopen(path, "r"))) {
goto cleanup;
}
- if (VIR_ALLOC_N(line, 1024) < 0) {
- virReportOOMError();
+ if (VIR_ALLOC_N(line, 1024) < 0)
goto cleanup;
- }
while (!feof(fp)) {
char *file, *context, *tmp;
tmp++;
if (virAsprintf(&file, "%s/securityselinuxlabeldata%s",
- abs_builddir, line) < 0) {
- virReportOOMError();
+ abs_builddir, line) < 0)
goto cleanup;
- }
if (*tmp != '\0' && *tmp != '\n') {
if (VIR_STRDUP(context, tmp) < 0) {
VIR_FREE(file);
context = NULL;
}
- if (VIR_EXPAND_N(*files, *nfiles, 1) < 0) {
- virReportOOMError();
+ if (VIR_EXPAND_N(*files, *nfiles, 1) < 0)
goto cleanup;
- }
(*files)[(*nfiles)-1].file = file;
(*files)[(*nfiles)-1].context = context;
size_t i;
if (virAsprintf(&xmlfile, "%s/securityselinuxlabeldata/%s.xml",
- abs_srcdir, testname) < 0) {
- virReportOOMError();
+ abs_srcdir, testname) < 0)
goto cleanup;
- }
if (virFileReadAll(xmlfile, 1024*1024, &xmlstr) < 0) {
goto cleanup;
virSecurityLabelDefPtr secdef;
if (VIR_ALLOC(def) < 0)
- goto no_memory;
+ goto error;
if (VIR_ALLOC_N(def->seclabels, 1) < 0)
- goto no_memory;
+ goto error;
if (VIR_ALLOC(secdef) < 0)
- goto no_memory;
+ goto error;
def->virtType = VIR_DOMAIN_VIRT_KVM;
def->seclabels[0] = secdef;
return def;
-no_memory:
- virReportOOMError();
error:
virDomainDefFree(def);
return NULL;
fprintf(stderr, "FAILED\n");
if (msg) {
char *str;
- if (virVasprintf(&str, msg, vargs) == 0) {
+ if (virVasprintfQuiet(&str, msg, vargs) == 0) {
fprintf(stderr, "%s", str);
VIR_FREE(str);
}
#define testError(...) \
do { \
char *str; \
- if (virAsprintf(&str, __VA_ARGS__) == 0) { \
+ if (virAsprintfQuiet(&str, __VA_ARGS__) == 0) { \
fprintf(stderr, "%s", str); \
VIR_FREE(str); \
} \
unsigned long msg_buf_size = VIR_NET_MESSAGE_INITIAL + VIR_NET_MESSAGE_LEN_MAX;
int ret = -1;
- if (!msg) {
- virReportOOMError();
+ if (!msg)
return -1;
- }
msg->header.prog = 0x11223344;
msg->header.vers = 0x01;
};
int ret = -1;
- if (!msg) {
- virReportOOMError();
+ if (!msg)
return -1;
- }
msg->bufferLength = 4;
- if (VIR_ALLOC_N(msg->buffer, msg->bufferLength) < 0) {
- virReportOOMError();
+ if (VIR_ALLOC_N(msg->buffer, msg->bufferLength) < 0)
goto cleanup;
- }
memcpy(msg->buffer, input_buf, msg->bufferLength);
msg->header.prog = 0x11223344;
0x00, 0x00, 0x00, 0x00, /* Error network pointer */
};
- if (!msg) {
- virReportOOMError();
+ if (!msg)
return -1;
- }
memset(&err, 0, sizeof(err));
int ret = -1;
msg->bufferLength = 4;
- if (VIR_ALLOC_N(msg->buffer, msg->bufferLength) < 0) {
- virReportOOMError();
+ if (VIR_ALLOC_N(msg->buffer, msg->bufferLength) < 0)
goto cleanup;
- }
memcpy(msg->buffer, input_buffer, msg->bufferLength);
memset(&err, 0, sizeof(err));
virAsprintf(&absqcow2, "%s/qcow2", datadir) < 0 ||
virAsprintf(&abswrap, "%s/wrap", datadir) < 0 ||
virAsprintf(&absqed, "%s/qed", datadir) < 0 ||
- virAsprintf(&abslink2, "%s/sub/link2", datadir) < 0) {
- virReportOOMError();
+ virAsprintf(&abslink2, "%s/sub/link2", datadir) < 0)
goto cleanup;
- }
if (virFileMakePath(datadir "/sub") < 0) {
fprintf(stderr, "unable to create directory %s\n", datadir "/sub");
NULLSTR(elt->directory),
elt->backingStoreFormat, elt->backingStoreIsFile,
elt->capacity, elt->encrypted) < 0) {
- virReportOOMError();
VIR_FREE(expect);
VIR_FREE(actual);
goto cleanup;