mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-14 18:48:13 -07:00
some extra NULL checks to please cppchecker
This commit is contained in:
parent
ad292e8810
commit
363bc0da8a
1 changed files with 16 additions and 0 deletions
|
@ -3601,16 +3601,32 @@ static const TRexChar *trex_matchnode(TRex *exp, TRexNode *node, const TRexChar
|
|||
/* public api */
|
||||
TRex *trex_compile(const TRexChar *pattern, const TRexChar **error, int flags) {
|
||||
TRex *exp = (TRex *)malloc(sizeof(TRex));
|
||||
if (exp == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
exp->_eol = exp->_bol = NULL;
|
||||
exp->_p = pattern;
|
||||
exp->_nallocated = (int)scstrlen(pattern) * sizeof(TRexChar);
|
||||
|
||||
exp->_nodes = (TRexNode *)malloc(exp->_nallocated * sizeof(TRexNode));
|
||||
if (exp->_nodes == NULL) {
|
||||
trex_free(exp);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
exp->_nsize = 0;
|
||||
exp->_matches = 0;
|
||||
exp->_nsubexpr = 0;
|
||||
exp->_first = trex_newnode(exp, OP_EXPR);
|
||||
exp->_error = error;
|
||||
exp->_jmpbuf = malloc(sizeof(jmp_buf));
|
||||
|
||||
if (exp->_jmpbuf == NULL) {
|
||||
trex_free(exp);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
exp->_flags = flags;
|
||||
if (setjmp(*((jmp_buf *)exp->_jmpbuf)) == 0) {
|
||||
int res = trex_list(exp);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue