summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Hacohen <tom@stosb.com>2014-05-16 14:30:33 +0100
committerTom Hacohen <tom@stosb.com>2014-05-16 14:33:00 +0100
commit9b265b006517e6931287499792783dc2947508c7 (patch)
treefd598390f723aa0086e7805650c8b7271ebcbef9
parent831c20464d212fde8d6ee125342e90e5e64efc1e (diff)
downloadefl-9b265b006517e6931287499792783dc2947508c7.tar.gz
Revert "Eo: Fix deref after free."
Coverity found the issue, but it's an issue we've already fixed in the past. I don't know how it got lost, but it seems like someone did a bad merge. Probably when migrating to Eo2. This reverts commit 831c20464d212fde8d6ee125342e90e5e64efc1e.
-rw-r--r--src/lib/eo/eo_base_class.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/lib/eo/eo_base_class.c b/src/lib/eo/eo_base_class.c
index af7a424e7e..21d7d2dc86 100644
--- a/src/lib/eo/eo_base_class.c
+++ b/src/lib/eo/eo_base_class.c
@@ -430,10 +430,11 @@ struct _Eo_Callback_Description
static void
_eo_callback_remove(Private_Data *pd, Eo_Callback_Description *cb)
{
- Eo_Callback_Description *itr, *pitr, *base;
+ Eo_Callback_Description *itr, *pitr;
- base = itr = pd->callbacks;
- pitr = NULL;
+ itr = pitr = pd->callbacks;
+ if (pd->callbacks == cb)
+ pd->callbacks = cb->next;
for ( ; itr; )
{
@@ -446,11 +447,6 @@ _eo_callback_remove(Private_Data *pd, Eo_Callback_Description *cb)
{
pitr->next = titr->next;
}
- else
- {
- /* If pitr is NULL, it means we need to update base. */
- base = titr->next;
- }
free(titr);
}
else
@@ -458,8 +454,6 @@ _eo_callback_remove(Private_Data *pd, Eo_Callback_Description *cb)
pitr = titr;
}
}
-
- pd->callbacks = base;
}
/* Actually remove, doesn't care about walking list, or delete_me */