Thread (82 messages) flat view 82 messages, 11 authors, 2021-09-23

Re: [PATCH v2 2/4] SANITIZE tests: fix memory leaks in t13*config*, add to whitelist

From: Jeff King <hidden>
Date: 2021-07-16 21:20:12

On Fri, Jul 16, 2021 at 07:18:59AM +0200, Andrzej Hunt wrote:
quoted
I see a few possible solutions:
 [...]
I can't say I _love_ any of that, but I think it would work (and
probably we'd adapt our helpers like git_config_pathname() to take a
def_string. Or I guess just have a def_string_free() which can be called
before writing into them).
Is it worth sidestepping the whole globals issue by migrating core.hookspath
(and other string config values) to be fetched via git_config_get_pathname()
and equivalents at the point of use instead?
Yeah, I almost suggested that. It probably does work OK in this
instance, but it's a much bigger change to convert all cases.

I'm also not sure if you'd run into tricky details. For instance,
calling git_config_* is doing an expensive-ish lookup in the cached
config (well, expensive to accessing a single pointer). So in cases
where we're going to access the string many times (say, in a loop), we'd
want our own variable. That might end up being easy by calling it once
outside the loop. Or it might not be, for cases where the variable is
used under the hood by a helper function.

-Peff
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help