]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
fixed a bug in x_realloc()
authorAndrew Tridgell <tridge@samba.org>
Mon, 17 Jul 2006 03:41:12 +0000 (05:41 +0200)
committerAndrew Tridgell <tridge@samba.org>
Mon, 17 Jul 2006 03:41:12 +0000 (05:41 +0200)
util.c

diff --git a/util.c b/util.c
index 073fa81c64515fe69ba84706598980b22f5712f4..29d0e5b4c57e0ec5a5cecc5d7d66ab2ca6094057 100644 (file)
--- a/util.c
+++ b/util.c
@@ -187,14 +187,10 @@ void *x_realloc(void *ptr, size_t size)
 {
        void *p2;
        if (!ptr) return x_malloc(size);
-       p2 = malloc(size);
+       p2 = realloc(ptr, size);
        if (!p2) {
                fatal("out of memory in x_realloc");
        }
-       if (ptr) {
-               memcpy(p2, ptr, size);
-               free(ptr);
-       }
        return p2;
 }