[PATCH] parser/scan.c: use strdup
Matt Turner
mattst88 at gmail.com
Wed Jun 16 13:15:01 PDT 2010
Found using
---
@@
expression E;
identifier i;
identifier address;
@@
- i = malloc(strlen(E) + 1);
- strcpy(address, E);
+ i = strdup(E);
---
Signed-off-by: Matt Turner <mattst88 at gmail.com>
---
hw/xfree86/parser/scan.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/hw/xfree86/parser/scan.c b/hw/xfree86/parser/scan.c
index 5312143..9f63570 100644
--- a/hw/xfree86/parser/scan.c
+++ b/hw/xfree86/parser/scan.c
@@ -1088,8 +1088,7 @@ void
xf86setSection (char *section)
{
free(configSection);
- configSection = malloc(strlen (section) + 1);
- strcpy (configSection, section);
+ configSection = strdup(section);
}
/*
--
1.7.1
More information about the xorg-devel
mailing list