OSDN Git Service

Fixed memory leak on realloc() failure. In fact reallocf() would do the thing but...
authorresver@gmail.com <resver@gmail.com@60bc1c72-a15a-11de-b98f-4500b42dc123>
Fri, 23 May 2014 19:24:13 +0000 (19:24 +0000)
committerresver@gmail.com <resver@gmail.com@60bc1c72-a15a-11de-b98f-4500b42dc123>
Fri, 23 May 2014 19:24:13 +0000 (19:24 +0000)
git-svn-id: http://exfat.googlecode.com/svn/trunk@402 60bc1c72-a15a-11de-b98f-4500b42dc123

fuse/main.c

index b9b412a..2f157c4 100644 (file)
@@ -379,6 +379,7 @@ static struct fuse_operations fuse_exfat_ops =
 static char* add_option(char* options, const char* name, const char* value)
 {
        size_t size;
+       char* optionsf = options;
 
        if (value)
                size = strlen(options) + strlen(name) + strlen(value) + 3;
@@ -388,6 +389,7 @@ static char* add_option(char* options, const char* name, const char* value)
        options = realloc(options, size);
        if (options == NULL)
        {
+               free(optionsf);
                exfat_error("failed to reallocate options string");
                return NULL;
        }