Skip to contentSkip to conversation

fs/9p/v9fs.c: memleak fix

PATCH In review Adrian Bunk 2 participants 2 messages Oct 19, 2007 – Oct 23, 2007 9P file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fs/9p/v9fs.c: memleak fix

This patch fixes a memory leak introduced by
commit ba17674fe02909fef049fd4b620a2805bdb8c693.

Spotted by the Coverity checker.

---

fs/9p/v9fs.c renamed from fs/9p/v9fs.c.old +1 -0
@@ -152,26 +152,27 @@ static void v9fs_parse_options(struct v9
 		case Opt_access:
 			s = match_strdup(&args[0]);
 			v9ses->flags &= ~V9FS_ACCESS_MASK;
 			if (strcmp(s, "user") == 0)
 				v9ses->flags |= V9FS_ACCESS_USER;
 			else if (strcmp(s, "any") == 0)
 				v9ses->flags |= V9FS_ACCESS_ANY;
 			else {
 				v9ses->flags |= V9FS_ACCESS_SINGLE;
 				v9ses->uid = simple_strtol(s, &e, 10);
 				if (*e != '\0')
 					v9ses->uid = ~0;
 			}
+			kfree(s);
 			break;
 
 		default:
 			continue;
 		}
 	}
 }
 
 /**
  * v9fs_session_init - initialize session
  * @v9ses: session information structure
  * @dev_name: device being mounted
  * @data: options