plug some memory leaks
authorroot <root@test1n1.VSOFS1.COM>
Mon, 24 Nov 2008 22:53:17 +0000 (09:53 +1100)
committerroot <root@test1n1.VSOFS1.COM>
Mon, 24 Nov 2008 22:53:17 +0000 (09:53 +1100)
migrate/remote-cache.c

index 94c4e2a80e8bdb6e575fb875b2b3865441ae08ff..d6f158cc4e753b9cc4b4f7a2b9f01eb189b7e299 100644 (file)
@@ -170,11 +170,13 @@ static void unlink_object(const char *path)
        ret = lstat(path, &st);
        if ((ret == -1) && (errno == ENOENT)) {
                errno = 0;
+               talloc_free(mem_ctx);
                return;
        }
 
        if ( (st.st_mode & S_IFMT) == S_IFREG) {
                unlink(path);
+               talloc_free(mem_ctx);
                return;
        }
 
@@ -741,7 +743,6 @@ finished:
        }
 
        talloc_free(mem_ctx);
-
        return ret;
 }
 
@@ -1234,7 +1235,8 @@ static int remote_cache_mknod(const char *path, mode_t mode, dev_t rdev)
        char *old_path = NULL;
        int ret;
 
-       if (!read_write) {
+       if (!read_write) {      
+               talloc_free(mem_ctx);
                return -EROFS;
        }
 
@@ -1281,6 +1283,7 @@ static int remote_cache_mkdir(const char *path, mode_t mode)
        int ret;
 
        if (!read_write) {
+               talloc_free(mem_ctx);
                return -EROFS;
        }
 
@@ -1326,6 +1329,7 @@ static int remote_cache_rmdir(const char *path)
        int ret;
 
        if (!read_write) {
+               talloc_free(mem_ctx);
                return -EROFS;
        }
 
@@ -1372,6 +1376,7 @@ static int remote_cache_unlink(const char *path)
        int ret;
 
        if (!read_write) {
+               talloc_free(mem_ctx);
                return -EROFS;
        }
 
@@ -1416,6 +1421,7 @@ static int remote_cache_chmod(const char *path, mode_t mode)
        int ret;
 
        if (!read_write) {
+               talloc_free(mem_ctx);
                return -EROFS;
        }
 
@@ -1460,6 +1466,7 @@ static int remote_cache_chown(const char *path, uid_t uid, gid_t gid)
        int ret;
 
        if (!read_write) {
+               talloc_free(mem_ctx);
                return -EROFS;
        }
 
@@ -1505,6 +1512,7 @@ static int remote_cache_create(const char *path, mode_t mode, struct fuse_file_i
        int fd;
 
        if (!read_write) {
+               talloc_free(mem_ctx);
                return -EROFS;
        }
 
@@ -1551,6 +1559,7 @@ static int remote_cache_utime(const char *path, struct utimbuf *times)
        int ret;
 
        if (!read_write) {
+               talloc_free(mem_ctx);
                return -EROFS;
        }
 
@@ -1596,6 +1605,7 @@ static int remote_cache_write(const char *path, const char *buf, size_t size, of
        int ret;
 
        if (!read_write) {
+               talloc_free(mem_ctx);
                return -EROFS;
        }
 
@@ -1653,6 +1663,7 @@ static int remote_cache_truncate(const char *path, off_t offset)
        int ret;
 
        if (!read_write) {
+               talloc_free(mem_ctx);
                return -EROFS;
        }
 
@@ -1697,6 +1708,7 @@ static int remote_cache_ftruncate(const char *path, off_t offset, struct fuse_fi
        int ret;
 
        if (!read_write) {
+               talloc_free(mem_ctx);
                return -EROFS;
        }
 
@@ -1743,6 +1755,7 @@ static int remote_cache_link(const char *path, const char *newpath)
        int ret;
 
        if (!read_write) {
+               talloc_free(mem_ctx);
                return -EROFS;
        }
 
@@ -1789,6 +1802,7 @@ static int remote_cache_symlink(const char *linkname, const char *path)
        int ret;
 
        if (!read_write) {
+               talloc_free(mem_ctx);
                return -EROFS;
        }
 
@@ -1834,6 +1848,7 @@ static int remote_cache_rename(const char *path, const char *newpath)
        int ret;
 
        if (!read_write) {
+               talloc_free(mem_ctx);
                return -EROFS;
        }