Skip to content
  • Philip Withnall's avatar
    gsrvtarget: Silence false positive NULL pointer dereference · a1ff120a
    Philip Withnall authored
    
    
    scan-build thinks there could be a `NULL` pointer dereference of
    `t->data` here. It’s wrong, so add an assertion to try and help it
    understand the control flow.
    
    The loop is exited as soon as a target is found whose weight is greater
    than or equal to a random value between 0 and the sum of all the weights
    in the set of remaining targets in the loop. By definition, the last
    target in the loop always satisfies this condition, so a target will
    always be chosen, and hence `t` will never be `NULL` within the loop.
    
    `t->data` will never be `NULL` by construction of the target list.
    
    Signed-off-by: default avatarPhilip Withnall <pwithnall@gnome.org>
    
    Helps: #1767
    a1ff120a