[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r22435 - gnunet/src/regex
From: |
gnunet |
Subject: |
[GNUnet-SVN] r22435 - gnunet/src/regex |
Date: |
Mon, 2 Jul 2012 15:23:12 +0200 |
Author: szengel
Date: 2012-07-02 15:23:12 +0200 (Mon, 02 Jul 2012)
New Revision: 22435
Modified:
gnunet/src/regex/regex.c
Log:
fixed leaks
Modified: gnunet/src/regex/regex.c
===================================================================
--- gnunet/src/regex/regex.c 2012-07-02 13:20:35 UTC (rev 22434)
+++ gnunet/src/regex/regex.c 2012-07-02 13:23:12 UTC (rev 22435)
@@ -525,6 +525,26 @@
from_state->transitions_tail, oth, t);
}
+/**
+ * Remove a 'transition' from 'state'.
+ *
+ * @param state state from which the to-be-removed transition originates.
+ * @param transition transition that should be removed from state 'state'.
+ */
+static void
+state_remove_transition (struct GNUNET_REGEX_State *state, struct Transition
*transition)
+{
+ if (NULL == state || NULL == transition)
+ return;
+
+ if (transition->from_state != state)
+ return;
+
+ state->transition_count--;
+ GNUNET_CONTAINER_DLL_remove (state->transitions_head,
state->transitions_tail, transition);
+ GNUNET_free (transition);
+}
+
/**
* Compare two states. Used for sorting.
*
@@ -763,11 +783,7 @@
if (GNUNET_NO == is_dup)
t_check->to_state = s1;
else
- {
- GNUNET_CONTAINER_DLL_remove (t_check->from_state->transitions_head,
- t_check->from_state->transitions_tail,
- t_check);
- }
+ state_remove_transition (t_check->from_state, t_check);
}
}
}
@@ -1065,7 +1081,6 @@
int ij_ik_cmp;
int ij_kj_cmp;
- //int ik_kj_cmp;
int ik_kk_cmp;
int kk_kj_cmp;
int clean_ik_kk_cmp;
@@ -1110,7 +1125,6 @@
ij_kj_cmp = nullstrcmp (R_last_ij, R_last_kj);
ij_ik_cmp = nullstrcmp (R_last_ij, R_last_ik);
ik_kk_cmp = nullstrcmp (R_last_ik, R_last_kk);
- //ik_kj_cmp = nullstrcmp (R_last_ik, R_last_kj);
kk_kj_cmp = nullstrcmp (R_last_kk, R_last_kj);
// Assign R_temp_(ik|kk|kj) to R_last[][] and remove epsilon as well
@@ -1373,6 +1387,10 @@
}
}
+ GNUNET_free_non_null (R_temp_ik);
+ GNUNET_free_non_null (R_temp_kk);
+ GNUNET_free_non_null (R_temp_kj);
+
if (NULL == R_cur_l && NULL == R_cur_r)
{
*R_cur_ij = NULL;
@@ -1381,31 +1399,26 @@
if (NULL != R_cur_l && NULL == R_cur_r)
{
- *R_cur_ij = GNUNET_strdup (R_cur_l);
+ *R_cur_ij = R_cur_l;
return;
}
if (NULL == R_cur_l && NULL != R_cur_r)
{
- *R_cur_ij = GNUNET_strdup (R_cur_r);
+ *R_cur_ij = R_cur_r;
return;
}
if (0 == nullstrcmp (R_cur_l, R_cur_r))
{
- *R_cur_ij = GNUNET_strdup (R_cur_l);
+ *R_cur_ij = R_cur_l;
+ GNUNET_free (R_cur_r);
return;
}
GNUNET_asprintf (R_cur_ij, "(%s|%s)", R_cur_l, R_cur_r);
-
- GNUNET_free_non_null (R_cur_l);
- GNUNET_free_non_null (R_cur_r);
-
- GNUNET_free_non_null (R_temp_ik);
- GNUNET_free_non_null (R_temp_kk);
- GNUNET_free_non_null (R_temp_kj);
-
+ GNUNET_free (R_cur_l);
+ GNUNET_free (R_cur_r);
}
/**
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r22435 - gnunet/src/regex,
gnunet <=