[PATCH v5 3/6] ncrypt/tests: Test NCryptFreeObject function.

Hans Leidekker hans at codeweavers.com
Wed Feb 16 11:45:34 CST 2022


On Wed, 2022-02-16 at 14:18 -0300, Santino Mazza wrote:
> > +    buf = calloc(1, 50);
> > +    ret = NCryptFreeObject((NCRYPT_KEY_HANDLE)buf);
> > +    ok(ret == NTE_INVALID_HANDLE, "got %#lx\n", ret);
> > +    free(buf);
> > +    }
> > +}
> > +
> >   START_TEST(ncrypt)
> >   {
> >       test_key_import_rsa();
> > +    test_ncrypt_free_object();
> >   }
> 
> Hello Hans, what is the reason of using calloc instead of just malloc at 
> the end of the function?

calloc() initializes the memory so this avoids the (small) risk that garbage
bytes constitute a valid header, leading to a test failure or crash.





More information about the wine-devel mailing list