abrt / satyr

Automatic problem management with anonymous reports
GNU General Public License v2.0
19 stars 23 forks source link

sr_distances_cluster_objects: Check arg safety #324

Closed michalfabik closed 3 years ago

michalfabik commented 3 years ago

Add an assert() to prevent calling cluster_clean() on a non-existent struct. (And ISO C forbids zero-length arrays anyway.)

Also, initialize clusters[0].objects right after declaration. GCC 11 complains about uninitialized variables when the initialization happens in a lower scope (inside a loop in this case) than the call to free, even when entering the lower scope is guaranteed.

Signed-off-by: Michal Fabik mfabik@redhat.com