• Dridi Boukelmoune's avatar
    acceptor: Address false positive in Coverity Scan · 4e4d66b3
    Dridi Boukelmoune authored
    Upon success we expect a non-null pointer, and to make sure this is not
    residual uninitialized stack memory, it is null'd beforehand.
    
        /bin/varnishd/cache/cache_acceptor.c: 375 in vca_mk_tcp()
        369     {
        370             struct suckaddr *sa;
        371             ssize_t sz;
        372
        373             AN(SES_Reserve_remote_addr(sp, &sa, &sz));
        374             assert(sz == vsa_suckaddr_len);
        >>>     CID 1517259:  Resource leaks  (RESOURCE_LEAK)
        >>>     Failing to save or free storage allocated by "VSA_Build(sa, &wa->acceptaddr, wa->acceptaddrlen)" leaks it.
        375             AN(VSA_Build(sa, &wa->acceptaddr, wa->acceptaddrlen));
        376             sp->sattr[SA_CLIENT_ADDR] = sp->sattr[SA_REMOTE_ADDR];
    
    It is precisely because we reserve the space to store the built suckaddr
    that there won't be a malloc() call made behind our back.
    
    For some reason, it only complained about one call site.
    4e4d66b3
cache_acceptor.c 20.6 KB