if ((cur = strstr(base, "platform")) == NULL)
return 0;
- if (VIR_ALLOC(def) < 0)
- return ret;
+ def = g_new0(virSysinfoSystemDef, 1);
base = cur;
/* Account for format 'platform : XXXX'*/
g_auto(virSysinfoDefPtr) ret = NULL;
g_autofree char *outbuf = NULL;
- if (VIR_ALLOC(ret) < 0)
- return NULL;
+ ret = g_new0(virSysinfoDef, 1);
if (virFileReadAll(CPUINFO, CPUINFO_FILE_LEN, &outbuf) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
if ((cur = strstr(base, "platform")) == NULL)
return 0;
- if (VIR_ALLOC(def) < 0)
- return ret;
+ def = g_new0(virSysinfoSystemDef, 1);
base = cur;
/* Account for format 'platform : XXXX'*/
/* Well, we've tried. Fall back to parsing cpuinfo */
virResetLastError();
- if (VIR_ALLOC(ret) < 0)
- return NULL;
+ ret = g_new0(virSysinfoDef, 1);
if (virFileReadAll(CPUINFO, CPUINFO_FILE_LEN, &outbuf) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
int ret = -1;
virSysinfoSystemDefPtr def;
- if (VIR_ALLOC(def) < 0)
- return ret;
+ def = g_new0(virSysinfoSystemDef, 1);
if (!virSysinfoParseS390Line(base, "Manufacturer", &def->manufacturer))
goto cleanup;
g_auto(virSysinfoDefPtr) ret = NULL;
g_autofree char *outbuf = NULL;
- if (VIR_ALLOC(ret) < 0)
- return NULL;
+ ret = g_new0(virSysinfoDef, 1);
/* Gather info from /proc/cpuinfo */
if (virFileReadAll(CPUINFO, CPUINFO_FILE_LEN, &outbuf) < 0) {
if ((cur = strstr(base, "BIOS Information")) == NULL)
return 0;
- if (VIR_ALLOC(def) < 0)
- return ret;
+ def = g_new0(virSysinfoBIOSDef, 1);
base = cur;
if ((cur = strstr(base, "Vendor: ")) != NULL) {
if ((cur = strstr(base, "System Information")) == NULL)
return 0;
- if (VIR_ALLOC(def) < 0)
- return ret;
+ def = g_new0(virSysinfoSystemDef, 1);
base = cur;
if ((cur = strstr(base, "Manufacturer: ")) != NULL) {
if ((cur = strstr(base, "Chassis Information")) == NULL)
return 0;
- if (VIR_ALLOC(def) < 0)
- return ret;
+ def = g_new0(virSysinfoChassisDef, 1);
base = cur;
if ((cur = strstr(base, "Manufacturer: ")) != NULL) {
if (!(cur = strstr(base, "OEM Strings")))
return 0;
- if (VIR_ALLOC(strings) < 0)
- return -1;
+ strings = g_new0(virSysinfoOEMStringsDef, 1);
while ((cur = strstr(cur, "String "))) {
char *eol;
if (virCommandRun(cmd, NULL) < 0)
return NULL;
- if (VIR_ALLOC(ret) < 0)
- return NULL;
+ ret = g_new0(virSysinfoDef, 1);
ret->type = VIR_SYSINFO_SMBIOS;