mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2026-05-12 11:18:11 -07:00
some extra NULL checks to please cppchecker
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user