Skip to contentSkip to conversation

Fix leaks in ISOFS.

PATCH In review Dave Jones 2 participants 3 messages Sep 1, 2004 Isofs filesystem

lore
Share & tools
lore

Dave Jones

author
#0 lore raw

PATCH 1/1 Fix leaks in ISOFS.

Spotted with the source checker from Coverity.com.

fs/isofs/rock.c +3 -1
diff -urpN --exclude-from=/home/davej/.exclude bk-linus/fs/isofs/rock.c linux-2.6/fs/isofs/rock.c
@@ -153,6 +153,7 @@ int get_rock_ridge_filename(struct iso_d
     }
   }
   MAYBE_CONTINUE(repeat,inode);
+  if (buffer) kfree(buffer);
   return retnamlen; /* If 0, this file did not have a NM field */
  out:
   if(buffer) kfree(buffer);
@@ -351,7 +352,6 @@ int parse_rock_ridge_inode_internal(stru
     }
   }
   MAYBE_CONTINUE(repeat,inode);
-  return 0;
  out:
   if(buffer) kfree(buffer);
   return 0;
@@ -515,6 +515,8 @@ static int rock_ridge_symlink_readpage(s
 		}
 	}
 	MAYBE_CONTINUE(repeat, inode);
+	if (buffer)
+		kfree(buffer);
 
 	if (rpnt == link)
 		goto fail;
#1 lore raw
Quoted 2 lines
   MAYBE_CONTINUE(repeat,inode);

+ if (buffer) kfree(buffer);

kfree(NULL) is just fine

author
#2 lore raw
Quoted 4 lines · Christoph Hellwig
Quoted 2 lines
   MAYBE_CONTINUE(repeat,inode);

+ if (buffer) kfree(buffer);

kfree(NULL) is just fine

True. I got carried away mirroring the style of all the other kfree operations in that code.

Dave