+Mon Mar 31 16:35:47 CEST 2008 Daniel Veillard <veillard@redhat.com>
+
+ * src/hash.c src/internal.h src/virterror.c: remove dandling
+ domain/net/conn pointers from error data when released.
+ * src/lxc_driver.c: fix a NULL/0 return error mismatch
+
Mon Mar 31 14:12:42 CEST 2008 Daniel Veillard <veillard@redhat.com>
* configure.in: small patch from Mike Gerdts to avoid problems with
virHashFree(conn->storageVols, (virHashDeallocator) virStorageVolFreeName);
virResetError(&conn->err);
+ if (__lastErr.conn == conn)
+ __lastErr.conn = NULL;
+
free(conn->name);
pthread_mutex_unlock(&conn->lock);
virHashError(conn, VIR_ERR_INTERNAL_ERROR,
_("domain missing from connection hash table"));
+ if (conn->err.dom == domain)
+ conn->err.dom = NULL;
+ if (__lastErr.dom == domain)
+ __lastErr.dom = NULL;
domain->magic = -1;
domain->id = -1;
free(domain->name);
virHashError(conn, VIR_ERR_INTERNAL_ERROR,
_("network missing from connection hash table"));
+ if (conn->err.net == network)
+ conn->err.net = NULL;
+ if (__lastErr.net == network)
+ __lastErr.net = NULL;
+
network->magic = -1;
free(network->name);
free(network);
#include "libvirt/virterror.h"
#include "internal.h"
-static virError lastErr = /* the last error */
+virError __lastErr = /* the last error */
{ 0, 0, NULL, VIR_ERR_NONE, NULL, NULL, NULL, NULL, NULL, 0, 0, NULL };
static virErrorFunc virErrorHandler = NULL; /* global error handler */
static void *virUserData = NULL; /* associated data */
virErrorPtr
virGetLastError(void)
{
- if (lastErr.code == VIR_ERR_OK)
+ if (__lastErr.code == VIR_ERR_OK)
return (NULL);
- return (&lastErr);
+ return (&__lastErr);
}
/*
{
if (to == NULL)
return (-1);
- if (lastErr.code == VIR_ERR_OK)
+ if (__lastErr.code == VIR_ERR_OK)
return (0);
- memcpy(to, &lastErr, sizeof(virError));
- return (lastErr.code);
+ memcpy(to, &__lastErr, sizeof(virError));
+ return (__lastErr.code);
}
/**
void
virResetLastError(void)
{
- virResetError(&lastErr);
+ virResetError(&__lastErr);
}
/**
const char *str1, const char *str2, const char *str3,
int int1, int int2, const char *msg, ...)
{
- virErrorPtr to = &lastErr;
+ virErrorPtr to = &__lastErr;
void *userData = virUserData;
virErrorFunc handler = virErrorHandler;
char *str;