aboutsummaryrefslogtreecommitdiff
path: root/src/regex/regex.c
diff options
context:
space:
mode:
authorMaximilian Szengel <gnunet@maxsz.de>2012-04-09 14:56:10 +0000
committerMaximilian Szengel <gnunet@maxsz.de>2012-04-09 14:56:10 +0000
commit08e1b05fdeffaf4e355bc3001348630ac9909eee (patch)
treeb21ce02d9cee5601f4accb53ad08b8be7c805d4d /src/regex/regex.c
parent47c8b99f44c7c9723061fe0e9c955edb3170a022 (diff)
downloadgnunet-08e1b05fdeffaf4e355bc3001348630ac9909eee.tar.gz
gnunet-08e1b05fdeffaf4e355bc3001348630ac9909eee.zip
fixes
Diffstat (limited to 'src/regex/regex.c')
-rw-r--r--src/regex/regex.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/regex/regex.c b/src/regex/regex.c
index 080e5d31e..250cca47c 100644
--- a/src/regex/regex.c
+++ b/src/regex/regex.c
@@ -589,6 +589,9 @@ dfa_merge_nondistinguishable_states (struct GNUNET_REGEX_Automaton *a)
589static void 589static void
590dfa_minimize (struct GNUNET_REGEX_Automaton *a) 590dfa_minimize (struct GNUNET_REGEX_Automaton *a)
591{ 591{
592 if (NULL == a)
593 return;
594
592 GNUNET_assert (DFA == a->type); 595 GNUNET_assert (DFA == a->type);
593 596
594 // 1. remove unreachable states 597 // 1. remove unreachable states
@@ -1100,7 +1103,8 @@ error:
1100 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Could not parse regex\n"); 1103 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Could not parse regex\n");
1101 if (NULL != error_msg) 1104 if (NULL != error_msg)
1102 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "%s\n", error_msg); 1105 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "%s\n", error_msg);
1103 GNUNET_free (p); 1106 if (NULL != p)
1107 GNUNET_free (p);
1104 while (NULL != ctx.stack_tail) 1108 while (NULL != ctx.stack_tail)
1105 { 1109 {
1106 GNUNET_REGEX_automaton_destroy (ctx.stack_tail); 1110 GNUNET_REGEX_automaton_destroy (ctx.stack_tail);
@@ -1163,6 +1167,13 @@ GNUNET_REGEX_construct_dfa (const char *regex, const size_t len)
1163 // Create NFA 1167 // Create NFA
1164 nfa = GNUNET_REGEX_construct_nfa (regex, len); 1168 nfa = GNUNET_REGEX_construct_nfa (regex, len);
1165 1169
1170 if (NULL == nfa)
1171 {
1172 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1173 "Could not create DFA, because NFA creation failed\n");
1174 return NULL;
1175 }
1176
1166 dfa = GNUNET_malloc (sizeof (struct GNUNET_REGEX_Automaton)); 1177 dfa = GNUNET_malloc (sizeof (struct GNUNET_REGEX_Automaton));
1167 dfa->type = DFA; 1178 dfa->type = DFA;
1168 1179