Add check for array length

This commit is contained in:
iabdalkader 2014-03-22 19:40:25 +02:00
parent 3a18b8f4b6
commit 0fd2047fad

View File

@ -23,6 +23,11 @@ array_t *imlib_count_blobs(struct image *image)
/* flood fill */
point_t *p=point_alloc(x, y);
while(p != NULL) {
if (array_length(points) > 500) {
xfree(p);
goto done;
}
/* add point to blob */
if (p->x < blob->x) {
blob->x = p->x;
@ -71,6 +76,7 @@ array_t *imlib_count_blobs(struct image *image)
}
}
done:
for (int i=0; i<array_length(blobs); i++) {
rectangle_t *blob = array_at(blobs, i);
// if (blob->w < 10) { /* blob too small */