lkml.org 
[lkml]   [2019]   [Aug]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v12 03/18] kunit: test: add string_stream a std::stream like string builder
On Mon, Aug 12, 2019 at 03:55:19PM -0700, Stephen Boyd wrote:
> Quoting Brendan Higgins (2019-08-12 11:24:06)
> > +void string_stream_clear(struct string_stream *stream)
> > +{
> > + struct string_stream_fragment *frag_container, *frag_container_safe;
> > +
> > + spin_lock(&stream->lock);
> > + list_for_each_entry_safe(frag_container,
> > + frag_container_safe,
> > + &stream->fragments,
> > + node) {
> > + list_del(&frag_container->node);
>
> Shouldn't we free the allocation here? Otherwise, if some test is going
> to add, add, clear, add, it's going to leak until the test is over?

So basically this means I should add a kunit_kfree and
kunit_resource_destroy (respective equivalents to devm_kfree, and
devres_destroy) and use kunit_kfree here?

> > + }
> > + stream->length = 0;
> > + spin_unlock(&stream->lock);
> > +}
> > +

\
 
 \ /
  Last update: 2019-08-13 01:35    [W:0.107 / U:0.212 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site