aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/dix/extension.c
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/dix/extension.c')
-rw-r--r--xorg-server/dix/extension.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/xorg-server/dix/extension.c b/xorg-server/dix/extension.c
index 57aef003f..f6b33d64c 100644
--- a/xorg-server/dix/extension.c
+++ b/xorg-server/dix/extension.c
@@ -89,15 +89,19 @@ AddExtension(char *name, int NumEvents, int NumErrors,
return((ExtensionEntry *) NULL);
}
- ext = malloc(sizeof(ExtensionEntry));
+ ext = calloc(sizeof (ExtensionEntry), 1);
if (!ext)
- return(NULL);
+ return NULL;
+ if (!dixAllocatePrivates(&ext->devPrivates, PRIVATE_EXTENSION)) {
+ free(ext);
+ return NULL;
+ }
ext->name = malloc(strlen(name) + 1);
ext->num_aliases = 0;
ext->aliases = (char **)NULL;
- ext->devPrivates = NULL;
if (!ext->name)
{
+ dixFreePrivates(ext->devPrivates, PRIVATE_EXTENSION);
free(ext);
return((ExtensionEntry *) NULL);
}
@@ -108,6 +112,7 @@ AddExtension(char *name, int NumEvents, int NumErrors,
if (!newexts)
{
free(ext->name);
+ dixFreePrivates(ext->devPrivates, PRIVATE_EXTENSION);
free(ext);
return((ExtensionEntry *) NULL);
}
@@ -144,7 +149,7 @@ AddExtension(char *name, int NumEvents, int NumErrors,
}
RegisterExtensionNames(ext);
- return(ext);
+ return ext;
}
Bool AddExtensionAlias(char *alias, ExtensionEntry *ext)
@@ -253,7 +258,7 @@ CloseDownExtensions(void)
for (j = extensions[i]->num_aliases; --j >= 0;)
free(extensions[i]->aliases[j]);
free(extensions[i]->aliases);
- dixFreePrivates(extensions[i]->devPrivates);
+ dixFreePrivates(extensions[i]->devPrivates, PRIVATE_EXTENSION);
free(extensions[i]);
}
free(extensions);
@@ -330,7 +335,7 @@ ProcListExtensions(ClientPtr client)
reply.length = bytes_to_int32(total_length);
buffer = bufptr = malloc(total_length);
if (!buffer)
- return(BadAlloc);
+ return BadAlloc;
for (i=0; i<NumExtensions; i++)
{
int len;