[CIFS] Fix mem leak on dfs referral
authorSteve French <sfrench@us.ibm.com>
Sat, 22 Mar 2008 22:57:44 +0000 (22:57 +0000)
committerSteve French <sfrench@us.ibm.com>
Sat, 22 Mar 2008 22:57:44 +0000 (22:57 +0000)
Signed-off-by: Igor Mammedov <niallain@gmail.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
fs/cifs/inode.c

index 7e4c24491729017803a81113316c9f9a1bf9d9c2..bc673c8c1e6b59eb7fc48464965db0e3e7835365 100644 (file)
@@ -211,7 +211,10 @@ try_again_CIFSSMBUnixQPathInfo:
        if (rc) {
                if (rc == -EREMOTE && !is_dfs_referral) {
                        is_dfs_referral = true;
-                       full_path = search_path;
+                       if (full_path != search_path) {
+                               kfree(full_path);
+                               full_path = search_path;
+                       }
                        goto try_again_CIFSSMBUnixQPathInfo;
                }
                goto cgiiu_exit;
@@ -422,7 +425,10 @@ try_again_CIFSSMBQPathInfo:
        if (rc) {
                if (rc == -EREMOTE && !is_dfs_referral) {
                        is_dfs_referral = true;
-                       full_path = search_path;
+                       if (full_path != search_path) {
+                               kfree(full_path);
+                               full_path = search_path;
+                       }
                        goto try_again_CIFSSMBQPathInfo;
                }
                goto cgii_exit;