mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-02-15 04:32:24 +00:00
dtinfo/DtSR: coverity CID 88552; memory corruption
This commit is contained in:
parent
8862366f00
commit
af58b6be10
3 changed files with 9 additions and 19 deletions
|
@ -333,7 +333,7 @@ DtSR_SearchResultsEntry::create_matches()
|
|||
DtSrHitword* kwics = NULL;
|
||||
long n_kwics = 0;
|
||||
|
||||
char* parseout = NULL;
|
||||
const char* parseout = NULL;
|
||||
|
||||
// hack! overwrite f_language, since austext's value is wrong
|
||||
// In future, the next lines should be removed.
|
||||
|
|
|
@ -41,7 +41,7 @@ using namespace std;
|
|||
#define True 1
|
||||
#endif
|
||||
|
||||
char *
|
||||
const char *
|
||||
StringParser::brute_force(const char* text_in, int n_of_pats,
|
||||
const char* patterns, int sensitive)
|
||||
{
|
||||
|
@ -238,18 +238,12 @@ StringParser::brute_force(const char* text_in, int n_of_pats,
|
|||
if (caped_text)
|
||||
delete[] caped_text;
|
||||
|
||||
string trunstr = text_run.str();
|
||||
char* ret_text = (char *)trunstr.c_str();
|
||||
static string trunstr = text_run.str();
|
||||
|
||||
if (ret_text == NULL)
|
||||
return NULL;
|
||||
else if (*ret_text == '\0') {
|
||||
delete[] ret_text;
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
return ret_text;
|
||||
if (!trunstr.size())
|
||||
return NULL;
|
||||
|
||||
return trunstr.c_str();
|
||||
}
|
||||
|
||||
const char *
|
||||
|
@ -332,16 +326,12 @@ StringParser::project_textrun(const char* org_textrun)
|
|||
const char *
|
||||
StringParser::hilite(const char* text, int n, const char* pats)
|
||||
{
|
||||
char* textrun = brute_force(text, n, pats);
|
||||
const char* textrun = brute_force(text, n, pats);
|
||||
|
||||
if (textrun == NULL)
|
||||
return NULL;
|
||||
|
||||
delete[] textrun;
|
||||
|
||||
const char* prjed_textrun = project_textrun(textrun);
|
||||
|
||||
return prjed_textrun;
|
||||
return project_textrun(textrun);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ public:
|
|||
static const char *
|
||||
hilite(const char* text, int n, const char* pats);
|
||||
|
||||
static char *
|
||||
static const char *
|
||||
brute_force(const char* text, int, const char* pats, int sensitive = 0);
|
||||
|
||||
static const char *
|
||||
|
|
Loading…
Reference in a new issue