diff options
| -rw-r--r-- | xlators/features/marker/utils/src/gsyncd.c | 10 | 
1 files changed, 6 insertions, 4 deletions
diff --git a/xlators/features/marker/utils/src/gsyncd.c b/xlators/features/marker/utils/src/gsyncd.c index 3f4c2c4b38a..63619b43c68 100644 --- a/xlators/features/marker/utils/src/gsyncd.c +++ b/xlators/features/marker/utils/src/gsyncd.c @@ -46,12 +46,14 @@ static int  duplexpand (void **buf, size_t tsiz, size_t *len)  {          size_t osiz = tsiz * *len; - -        *buf = realloc (*buf, osiz << 1); -        if (!*buf) +        char *p = realloc (*buf, osiz << 1); +        if (!p) { +                free(*buf);                  return -1; +        } -        memset ((char *)*buf + osiz, 0, osiz); +        memset (p + osiz, 0, osiz); +        *buf = p;          *len <<= 1;          return 0;  | 
