This is an array of entity structs. But you want to have an array of pointers to entities, right?
sec = malloc(sizeof(ENTITY)*i);
That's wrong. First you already defined and initialized sec. It already is an array of ENTITY structs and it's allocated as sec is static. Second you allocate too much memory. You don't need to allocate space for a complete ENTITY struct. The engine does that when you call ent_create. So you just need space for the pointers to the entities and that would be:
sec = malloc(sizeof(ENTITY*)*i);
Note the star behind ENTITY.
You have to decide what you want to do. For a static array of pointers to entities
will be sufficient. No further allocation is required then. When you want to dynamically create the array you should use
ENTITY** sec = sys_malloc(sizeof(ENTITY*) * NUMBER_OF_ELEMENTS);