mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-02-15 04:32:24 +00:00
dtinfo/TextParser.C: coverity CID 89054; mem corruption
This commit is contained in:
parent
73b6311a83
commit
8862366f00
2 changed files with 8 additions and 7 deletions
|
@ -252,7 +252,7 @@ StringParser::brute_force(const char* text_in, int n_of_pats,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
const char *
|
||||||
StringParser::project_textrun(const char* org_textrun)
|
StringParser::project_textrun(const char* org_textrun)
|
||||||
{
|
{
|
||||||
if (org_textrun == NULL || *org_textrun == '\0')
|
if (org_textrun == NULL || *org_textrun == '\0')
|
||||||
|
@ -325,11 +325,11 @@ StringParser::project_textrun(const char* org_textrun)
|
||||||
|
|
||||||
ret_text << off << '\t' << len << '\n' << '\0';
|
ret_text << off << '\t' << len << '\n' << '\0';
|
||||||
|
|
||||||
string rettstr = ret_text.str();
|
static string rettstr = ret_text.str();
|
||||||
return (char *)rettstr.c_str();
|
return rettstr.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
const char *
|
||||||
StringParser::hilite(const char* text, int n, const char* pats)
|
StringParser::hilite(const char* text, int n, const char* pats)
|
||||||
{
|
{
|
||||||
char* textrun = brute_force(text, n, pats);
|
char* textrun = brute_force(text, n, pats);
|
||||||
|
@ -337,9 +337,10 @@ StringParser::hilite(const char* text, int n, const char* pats)
|
||||||
if (textrun == NULL)
|
if (textrun == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
char* prjed_textrun = project_textrun(textrun);
|
|
||||||
delete[] textrun;
|
delete[] textrun;
|
||||||
|
|
||||||
|
const char* prjed_textrun = project_textrun(textrun);
|
||||||
|
|
||||||
return prjed_textrun;
|
return prjed_textrun;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,13 +9,13 @@ class StringParser {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
static char *
|
static const char *
|
||||||
hilite(const char* text, int n, const char* pats);
|
hilite(const char* text, int n, const char* pats);
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
brute_force(const char* text, int, const char* pats, int sensitive = 0);
|
brute_force(const char* text, int, const char* pats, int sensitive = 0);
|
||||||
|
|
||||||
static char *
|
static const char *
|
||||||
project_textrun(const char *);
|
project_textrun(const char *);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue