summaryrefslogtreecommitdiff
path: root/dix/atom.c
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2011-10-24 23:16:30 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2011-11-23 12:15:05 -0800
commit08093c25a91c07ab8af7cece9bba738b827cfd1b (patch)
tree782fcb6921d2e432de5b9ba886b539f08c8ff596 /dix/atom.c
parentacde97a39d35bfb03af2614c68176ad9afb71f53 (diff)
Convert some malloc + strncpy pairs into strndup calls
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Diffstat (limited to 'dix/atom.c')
-rw-r--r--dix/atom.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/dix/atom.c b/dix/atom.c
index 88b40db65..83ff71a7d 100644
--- a/dix/atom.c
+++ b/dix/atom.c
@@ -118,14 +118,11 @@ MakeAtom(const char *string, unsigned len, Bool makeit)
}
else
{
- char *newstring = malloc(len + 1);
- if (!newstring) {
+ nd->string = strndup(string, len);
+ if (!nd->string) {
free(nd);
return BAD_RESOURCE;
}
- strncpy(newstring, string, (int)len);
- newstring[len] = 0;
- nd->string = newstring;
}
if ((lastAtom + 1) >= tableLength) {
NodePtr *table;