From: Jeff Layton Date: Mon, 20 Jul 2009 17:40:52 +0000 (-0400) Subject: cifs: free nativeFileSystem field before allocating a new one X-Git-Tag: v2.6.30.4~52 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6b5600f321f51cd409d05f475128d40fc7241a2d;p=thirdparty%2Fkernel%2Fstable.git cifs: free nativeFileSystem field before allocating a new one commit 90a98b2f3f3647fb17667768a348b2b219f2a9f7 upstream. ...otherwise, we'll leak this memory if we have to reconnect (e.g. after network failure). Signed-off-by: Jeff Layton Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 4aa81a507b741..1dc14f219adaa 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -2745,6 +2745,7 @@ CIFSTCon(unsigned int xid, struct cifsSesInfo *ses, strncpy(tcon->treeName, tree, MAX_TREE_SIZE); /* mostly informational -- no need to fail on error here */ + kfree(tcon->nativeFileSystem); tcon->nativeFileSystem = cifs_strndup_from_ucs(bcc_ptr, bytes_left, is_unicode, nls_codepage);