Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Kaz Kylheku <643-408-1753@kylheku.com> Newsgroups: comp.lang.c Subject: Re: valgrind leak I can't find Date: Thu, 22 Aug 2024 15:20:24 -0000 (UTC) Organization: A noiseless patient Spider Lines: 23 Message-ID: <20240822081732.909@kylheku.com> References: Injection-Date: Thu, 22 Aug 2024 17:20:25 +0200 (CEST) Injection-Info: dont-email.me; posting-host="90d9ee9f577d3e1dd330bc58c9f42403"; logging-data="519416"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/NYIklaCMz+apwQdpkCU/3M4wuhxkSmGk=" User-Agent: slrn/pre1.0.4-9 (Linux) Cancel-Lock: sha1:0ud4bAK1lkEzFWuWjJCb58hU5aw= Bytes: 1714 On 2024-08-22, Mark Summerfield wrote: > The first leak in the detailed report is this: > >==18005== 5 bytes in 1 blocks are definitely lost in loss record 1 of 25 >==18005== at 0x48407B4: malloc (vg_replace_malloc.c:381) >==18005== by 0x49E38E9: strdup (strdup.c:42) >==18005== by 0x10CAD4: vec_str_tests (vec_str_test.c:77) >==18005== by 0x109346: main (cx_test.c:26) > > vec_str_test.c:77 is: > > vec_str_insert(&v1, 4, strdup("beta")); > > The reason I use strdup() is because my VecStr type takes ownership of > the strings it holds. Does your program free the vector before terminating, including iterating over the string elements and freeing them individually? -- TXR Programming Language: http://nongnu.org/txr Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal Mastodon: @Kazinator@mstdn.ca