We study the reliability of dark-matter halo detections with three different linear filters applied to weak-lensing data. We use ray-tracing in the multiple lens-plane approximation through a large cosmological simulation to construct realizations of cosmic lensing by large-scale structures between redshifts zero and two. We apply the filters mentioned above to detect peaks in the weak-lensing signal and compare them with the true population of dark matter halos present in the simulation. We confirm the stability and performance of a filter optimized for suppressing the contamination by large-scale structure. It allows the reliable detection of dark-matter halos with masses above a few times 1e13 M_sun/h with a fraction of spurious detections below ~10%. For sources at redshift two, 50% of the halos more massive than ~7e13 M_sun/h are detected, and completeness is reached at ~2e14 M_sun/h.