Thread (151 messages) 151 messages, 6 authors, 2017-05-11

Re: [PATCH v3 14/25] setup_discovered_git_dir(): plug memory leak

From: Jeff King <hidden>
Date: 2017-05-02 18:15:19

On Tue, May 02, 2017 at 10:20:29AM -0700, Stefan Beller wrote:
quoted
-                       gitdir = real_pathdup(gitdir, 1);
+                       gitdir = to_free = real_pathdup(gitdir, 1);
                if (chdir(cwd->buf))
                        die_errno("Could not come back to cwd");
As the original motivation was to shut up Coverity, this may not
accomplish that goal, as in the path of taking the die_errno, we do not
free `to_free`. But that is ok as the actual goal is to hav no memleaks
in the good case. A memleak just before a die is no big deal.
I think Coverity understands our NORETURN attributes, so this should be
fine (and if it doesn't, then we should fix that in the model file; but
from the general results I've seen, it does).

-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