summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Pavlik <rpavlik@iastate.edu>2011-10-28 10:05:35 -0500
committerJon TURNEY <jon.turney@dronecode.org.uk>2012-11-28 21:13:24 +0000
commitd95b5d661917b994daff23be5eff30271435067d (patch)
treed6da6b1d436b65c449f8d8d393c27ff6ec2e460b
parent352e6b7386610f1beb74b9e8ee4cbfbc8e60d9cd (diff)
dix/registry.c: Free old memory upon realloc failure
Signed-off-by: Ryan Pavlik <rpavlik@iastate.edu>
-rw-r--r--dix/registry.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/dix/registry.c b/dix/registry.c
index 4c74267f2..bf0a1dd0f 100644
--- a/dix/registry.c
+++ b/dix/registry.c
@@ -70,8 +70,14 @@ double_size(void *p, unsigned n, unsigned size)
s = 0;
n = f = BASE_SIZE * size;
}
+ {
+ char * newptr = realloc(*ptr, n);
+ if (!newptr) {
+ free(*ptr);
+ }
+ *ptr = newptr;
+ }
- *ptr = realloc(*ptr, n);
if (!*ptr) {
dixResetRegistry();
return FALSE;