Free str unconditionally since we allocate it without WITH_AUDIT
too.
}
#if WITH_AUDIT
- if (auditfd < 0) {
- VIR_FREE(str);
- return;
- }
-
- if (str) {
+ if (str && auditfd >= 0) {
static const int record_types[] = {
[VIR_AUDIT_RECORD_MACHINE_CONTROL] = AUDIT_VIRT_CONTROL,
[VIR_AUDIT_RECORD_MACHINE_ID] = AUDIT_VIRT_MACHINE_ID,
VIR_WARN("Failed to send audit message %s: %s",
NULLSTR(str), virStrerror(errno, ebuf, sizeof(ebuf)));
}
- VIR_FREE(str);
}
#endif
+ VIR_FREE(str);
}
void virAuditClose(void)