Permalink
Browse files

Fix crash when using average extremas

The reason was that if an "averaged extrema" was already in the
list of extremas, then it would insert a NULL extrema in the list
which would be accessed later, causing a segfault.
  • Loading branch information...
1 parent 70b9be4 commit fea0bc232ddab3675b4b8440f4cd8843d0328964 @joaquimrocha committed Oct 3, 2012
Showing with 5 additions and 8 deletions.
  1. +5 −8 skeltrack/skeltrack-skeleton.c
@@ -1127,14 +1127,11 @@ get_extremas (SkeltrackSkeleton *self, Node *centroid)
/* If the new averaged extrema is not already an extrema
set it for addition */
- if (g_list_find (averaged_extremas, node_centroid) == NULL)
- extrema = node_centroid;
-
- /* If the non-averaged extrema is picked and
- it is the same as a previous averaged extrema
- set it to NULL */
- if (g_list_find (averaged_extremas, extrema) != NULL)
- extrema = NULL;
+ if (g_list_find (averaged_extremas, node_centroid) == NULL &&
+ g_list_find (extremas, node_centroid) == NULL)
+ {
+ extrema = node_centroid;
+ }
g_slice_free (Node, cent);

0 comments on commit fea0bc2

Please sign in to comment.