From ae34e308c481995aeb3ae58268130715fa94ea3f Mon Sep 17 00:00:00 2001 From: BlackLight Date: Tue, 15 Feb 2011 17:03:24 +0100 Subject: [PATCH] Fixing a segfault in neural clusters duplicates removal --- neural_cluster.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/neural_cluster.c b/neural_cluster.c index 872b466..82f3091 100644 --- a/neural_cluster.c +++ b/neural_cluster.c @@ -115,6 +115,21 @@ __AI_neural_clusters_to_xml ( kmeans_t *km, AI_alerts_per_neuron *alerts_per_neu { for ( m=0; m < j && !are_equal; m++ ) { + if ( !( km->clusters )) + { + continue; + } + + if ( !( km->clusters[l] )) + { + continue; + } + + if ( !( km->clusters[l][m] )) + { + continue; + } + tmp_key.x = km->clusters[l][m][0]; tmp_key.y = km->clusters[l][m][1]; HASH_FIND ( hh, alerts_per_neuron, &tmp_key, sizeof ( tmp_key ), tmp_iterator );