Re: [PATCH 01/11] t: move reftable/record_test.c to the unit testing framework

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jun 26, 2024 at 1:52 PM Karthik Nayak <karthik.188@xxxxxxxxx> wrote:
> But to summarize, seems like we're not sure why this was added. CC'ing
> Han-Wen here incase he remembers the intent.

The copy functions are like C++ copy constructors. They discard the
old data, and copy over the new data into the destination.

If we forget to free() something in the "discard old data" step, that
would be exercised by initializing the record to hold data (1st copy
call) and then triggering the cleanup (2nd copy call.). Valgrind or
similar tooling would then detect the leak.

-- 
Han-Wen Nienhuys - hanwenn@xxxxxxxxx - http://www.xs4all.nl/~hanwen





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux