use taosStrdup
This commit is contained in:
parent
3adaebd2a0
commit
152758b72d
|
@ -1401,12 +1401,11 @@ int32_t threadGetRegComp(regex_t **regex, const char *pPattern) {
|
||||||
if (ppRegex == NULL) {
|
if (ppRegex == NULL) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
pOldPattern = (char *)taosMemoryMalloc(strlen(pPattern) + 1);
|
pOldPattern = taosStrdup(pPattern);
|
||||||
if (NULL == pOldPattern) {
|
if (NULL == pOldPattern) {
|
||||||
uError("Failed to Malloc when compile regex pattern %s.", pPattern);
|
uError("Failed to Malloc when compile regex pattern %s.", pPattern);
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
strcpy(pOldPattern, pPattern);
|
|
||||||
ppUsingRegex = ppRegex;
|
ppUsingRegex = ppRegex;
|
||||||
pRegex = &((*ppUsingRegex)->pRegex);
|
pRegex = &((*ppUsingRegex)->pRegex);
|
||||||
*regex = &(*ppRegex)->pRegex;
|
*regex = &(*ppRegex)->pRegex;
|
||||||
|
|
Loading…
Reference in New Issue