Since the function atoi(l) series stop at the first non numeric chars,
So there's no need to strdup the original s and modify s[len-1] = '\0'
Signed-off-by: Rock Lee <zimilo@xxxxxxxxxxxxxx>
---
mkfs.c | 5 +----
1 files changed, 1 insertions(+), 4 deletions(-)
diff --git a/mkfs.c b/mkfs.c
index 47f0c9c..663d73c 100644
--- a/mkfs.c
+++ b/mkfs.c
@@ -61,8 +61,6 @@ static u64 parse_size(char *s)
u64 mult = 1;
u64 ret;
- s = strdup(s);
-
if (len && !isdigit(s[len - 1])) {
c = tolower(s[len - 1]);
switch (c) {
@@ -78,10 +76,9 @@ static u64 parse_size(char *s)
fprintf(stderr, "Unknown size descriptor %c\n", c);
exit(1);
}
- s[len - 1] = '\0';
}
+
ret = atol(s) * mult;
- free(s);
return ret;
}
--
1.7.7.6
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html