+Sat Dec 1 10:42:34 EST 2007 Daniel P. Berrange <berrange@redhat.com>
+
+ * src/hash.c: reset error object when releasing connection
+ * src/iptables.c: don't strdup() param passed to strcmp()
+ * src/qemu_driver.c: free TLS directory path in driver shutdown
+ * src/remote_internal.c: don't strdup() params for virRaiseError
+ * src/virsh.c: reset global error object at shutdown. Release
+ connection state during abnormal shutdown
+
Sat Dec 1 10:22:34 EST 2007 Daniel P. Berrange <berrange@redhat.com>
* src/qemu_driver.c: Fix off-by-1 buffer NULL termination in
virHashFree(conn->networks, (virHashDeallocator) virNetworkFreeName);
if (conn->hashes_mux != NULL)
xmlFreeMutex(conn->hashes_mux);
+ virResetError(&conn->err);
free(conn);
return(0);
}
int i;
for (i = 0; i < rules->nrules; i++)
- if (!strcmp(rules->rules[i].rule, strdup(rule)))
+ if (!strcmp(rules->rules[i].rule, rule))
break;
if (i >= rules->nrules)
if (qemu_driver->networkAutostartDir)
free(qemu_driver->networkAutostartDir);
+ if (qemu_driver->vncTLSx509certdir)
+ free(qemu_driver->vncTLSx509certdir);
+
if (qemu_driver->brctl)
brShutdown(qemu_driver->brctl);
if (qemu_driver->iptables)
dom = err->dom ? get_nonnull_domain (conn, *err->dom) : NULL;
net = err->net ? get_nonnull_network (conn, *err->net) : NULL;
- /* These strings are nullable. OK to ignore the return value
- * of strdup since these strings are informational.
- */
- char *str1 = err->str1 ? strdup (*err->str1) : NULL;
- char *str2 = err->str2 ? strdup (*err->str2) : NULL;
- char *str3 = err->str3 ? strdup (*err->str3) : NULL;
-
- char *message = err->message ? strdup (*err->message) : NULL;
-
__virRaiseError (conn, dom, net,
err->domain, err->code, err->level,
- str1, str2, str3,
+ err->str1 ? *err->str1 : NULL,
+ err->str2 ? *err->str2 : NULL,
+ err->str3 ? *err->str3 : NULL,
err->int1, err->int2,
- "%s", message);
+ "%s", err->message ? *err->message : NULL);
}
/* get_nonnull_domain and get_nonnull_network turn an on-wire
vshDeinit(vshControl * ctl)
{
vshCloseLogFile(ctl);
-
+ if (ctl->name)
+ free(ctl->name);
if (ctl->conn) {
if (virConnectClose(ctl->conn) != 0) {
ctl->conn = NULL; /* prevent recursive call from vshError() */
"failed to disconnect from the hypervisor");
}
}
+ virResetLastError();
+
return TRUE;
}
ctl->name = strdup(defaultConn);
}
- if (!vshParseArgv(ctl, argc, argv))
+ if (!vshParseArgv(ctl, argc, argv)) {
+ vshDeinit(ctl);
exit(EXIT_FAILURE);
+ }
- if (!vshInit(ctl))
+ if (!vshInit(ctl)) {
+ vshDeinit(ctl);
exit(EXIT_FAILURE);
+ }
if (!ctl->imode) {
ret = vshCommandRun(ctl, ctl->cmd);