diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2013-10-26 00:06:22 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2013-11-01 22:19:24 -0700 |
commit | 7d34534c050cb4366c7b14bff585c17d6d578f89 (patch) | |
tree | 24a5fad5b544e8e7bdac01fc37e7e561e25989c5 /src/FreeType | |
parent | 8a9fc31628a98e3cdaae6078bb5d92bce06c37ac (diff) |
Replace malloc(strlen)+strcpy/strcat calls with strdup
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'src/FreeType')
-rw-r--r-- | src/FreeType/ftfuncs.c | 4 | ||||
-rw-r--r-- | src/FreeType/xttcap.c | 3 |
2 files changed, 2 insertions, 5 deletions
diff --git a/src/FreeType/ftfuncs.c b/src/FreeType/ftfuncs.c index 091339d..2c90cf9 100644 --- a/src/FreeType/ftfuncs.c +++ b/src/FreeType/ftfuncs.c @@ -2289,13 +2289,11 @@ FreeTypeSetUpTTCap( char *fileName, FontScalablePtr vals, } } else{ - *dynStrFTFileName = malloc(strlen(*dynStrRealFileName)+1); + *dynStrFTFileName = strdup(*dynStrRealFileName); if( *dynStrFTFileName == NULL ){ result = AllocError; goto quit; } - **dynStrFTFileName = '\0'; - strcat(*dynStrFTFileName,*dynStrRealFileName); } } /* diff --git a/src/FreeType/xttcap.c b/src/FreeType/xttcap.c index c1d8e67..104dc89 100644 --- a/src/FreeType/xttcap.c +++ b/src/FreeType/xttcap.c @@ -234,14 +234,13 @@ SPropRecValList_add_record(SDynPropRecValList *pThisList, { char *p; - if (NULL == (p = malloc(strlen(strValue)+1))) { + if (NULL == (p = strdup(strValue))) { fprintf(stderr, "truetype font property : " "cannot allocate memory.\n"); result = True; goto quit; } - strcpy(p, strValue); SPropContainer_value_str(&tmpContainerE) = p; } break; |