summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2024-03-10 15:32:12 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2024-03-10 15:32:12 -0700
commitcc2f4d685f28e231ef5807c7e7a60b6d11e3ebd9 (patch)
treed46ab4dc679685e51f6f75c2fd2512f96621c6d0
parent4c5ce451f0cb548a2ed66c680709050616a583f6 (diff)
Use strdup() instead of malloc(strlen()+1); memcpy() pairs
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--src/sis_opt.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/sis_opt.c b/src/sis_opt.c
index 7068a7e..7a76089 100644
--- a/src/sis_opt.c
+++ b/src/sis_opt.c
@@ -949,16 +949,13 @@ SiSOptions(ScrnInfoPtr pScrn)
free(tempstr);
}
if((strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_METAMODES))) {
- pSiS->MetaModes = malloc(strlen(strptr) + 1);
- if(pSiS->MetaModes) memcpy(pSiS->MetaModes, strptr, strlen(strptr) + 1);
+ pSiS->MetaModes = strdup(strptr);
}
if((strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_CRT2HSYNC))) {
- pSiS->CRT2HSync = malloc(strlen(strptr) + 1);
- if(pSiS->CRT2HSync) memcpy(pSiS->CRT2HSync, strptr, strlen(strptr) + 1);
+ pSiS->CRT2HSync = strdup(strptr);
}
if((strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_CRT2VREFRESH))) {
- pSiS->CRT2VRefresh = malloc(strlen(strptr) + 1);
- if(pSiS->CRT2VRefresh) memcpy(pSiS->CRT2VRefresh, strptr, strlen(strptr) + 1);
+ pSiS->CRT2VRefresh = strdup(strptr);
}
if((strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_MERGEDDPI))) {
int val1 = 0, val2 = 0;