diff options
Diffstat (limited to 'src/regexp.cpp')
-rw-r--r-- | src/regexp.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/regexp.cpp b/src/regexp.cpp index ff2d09a..e5a3535 100644 --- a/src/regexp.cpp +++ b/src/regexp.cpp | |||
@@ -17,14 +17,21 @@ RegExp::RegExp( const char *sSrc ) : | |||
17 | 17 | ||
18 | RegExp::~RegExp() | 18 | RegExp::~RegExp() |
19 | { | 19 | { |
20 | regfree( &re ); | 20 | if( bCompiled ) |
21 | delete[] aSubStr; | 21 | { |
22 | regfree( &re ); | ||
23 | delete[] aSubStr; | ||
24 | } | ||
22 | } | 25 | } |
23 | 26 | ||
24 | void RegExp::compile( const char *sSrc ) | 27 | void RegExp::compile( const char *sSrc ) |
25 | { | 28 | { |
26 | if( bCompiled ) | 29 | if( bCompiled ) |
27 | throw BuildException("Already compiled."); | 30 | { |
31 | regfree( &re ); | ||
32 | delete[] aSubStr; | ||
33 | bCompiled = false; | ||
34 | } | ||
28 | 35 | ||
29 | int nErr = regcomp( &re, sSrc, REG_EXTENDED|REG_NEWLINE ); | 36 | int nErr = regcomp( &re, sSrc, REG_EXTENDED|REG_NEWLINE ); |
30 | if( nErr ) | 37 | if( nErr ) |