git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Plug memory leak in update-cache.c
@ 2005-04-14  8:53 Martin Schlemmer
  2005-04-15 23:48 ` Petr Baudis
  0 siblings, 1 reply; 4+ messages in thread
From: Martin Schlemmer @ 2005-04-14  8:53 UTC (permalink / raw
  To: GIT Mailing Lists


[-- Attachment #1.1: Type: text/plain, Size: 641 bytes --]

Hi,

Might not be that an big an issue as it should be freed on exit, but
might cause problems with big trees.

----

Plug memory leak in update-cache.c.

Signed-off-by: Martin Schlemmer <azarah@nosferatu.za.org>

update-cache.c:  22f3ccd47db4f0888901109a8cbf883d272d1cba
--- 22f3ccd47db4f0888901109a8cbf883d272d1cba/update-cache.c
+++ uncommitted/update-cache.c
@@ -202,6 +202,7 @@
                        printf("%s: needs update\n", ce->name);
                        continue;
                }
+               free(active_cache[i]);
                active_cache[i] = new;
        }
 }


-- 
Martin Schlemmer


[-- Attachment #1.2: git-plug-leak-in-update_cache.patch --]
[-- Type: text/x-patch, Size: 302 bytes --]

update-cache.c:  22f3ccd47db4f0888901109a8cbf883d272d1cba
--- 22f3ccd47db4f0888901109a8cbf883d272d1cba/update-cache.c
+++ uncommitted/update-cache.c
@@ -202,6 +202,7 @@
 			printf("%s: needs update\n", ce->name);
 			continue;
 		}
+		free(active_cache[i]);
 		active_cache[i] = new;
 	}
 }

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Plug memory leak in update-cache.c
  2005-04-14  8:53 Plug memory leak in update-cache.c Martin Schlemmer
@ 2005-04-15 23:48 ` Petr Baudis
  2005-04-16  0:00   ` Martin Schlemmer
  0 siblings, 1 reply; 4+ messages in thread
From: Petr Baudis @ 2005-04-15 23:48 UTC (permalink / raw
  To: Martin Schlemmer; +Cc: GIT Mailing Lists

Dear diary, on Thu, Apr 14, 2005 at 10:53:50AM CEST, I got a letter
where Martin Schlemmer <azarah@nosferatu.za.org> told me that...
> Hi,
> 
> Might not be that an big an issue as it should be freed on exit, but
> might cause problems with big trees.
> 
> ----
> 
> Plug memory leak in update-cache.c.
> 
> Signed-off-by: Martin Schlemmer <azarah@nosferatu.za.org>
> 
> update-cache.c:  22f3ccd47db4f0888901109a8cbf883d272d1cba
> --- 22f3ccd47db4f0888901109a8cbf883d272d1cba/update-cache.c
> +++ uncommitted/update-cache.c
> @@ -202,6 +202,7 @@
>                         printf("%s: needs update\n", ce->name);
>                         continue;
>                 }
> +               free(active_cache[i]);
>                 active_cache[i] = new;
>         }
>  }

FYI, new could've contained active_cache[i] at that time, so you needed
to check for that. Fixed though, thanks for pointing it out.

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Plug memory leak in update-cache.c
  2005-04-15 23:48 ` Petr Baudis
@ 2005-04-16  0:00   ` Martin Schlemmer
  2005-04-16  0:04     ` Petr Baudis
  0 siblings, 1 reply; 4+ messages in thread
From: Martin Schlemmer @ 2005-04-16  0:00 UTC (permalink / raw
  To: Petr Baudis; +Cc: GIT Mailing Lists

[-- Attachment #1: Type: text/plain, Size: 1155 bytes --]

On Sat, 2005-04-16 at 01:48 +0200, Petr Baudis wrote:
> Dear diary, on Thu, Apr 14, 2005 at 10:53:50AM CEST, I got a letter
> where Martin Schlemmer <azarah@nosferatu.za.org> told me that...
> > Hi,
> > 
> > Might not be that an big an issue as it should be freed on exit, but
> > might cause problems with big trees.
> > 
> > ----
> > 
> > Plug memory leak in update-cache.c.
> > 
> > Signed-off-by: Martin Schlemmer <azarah@nosferatu.za.org>
> > 
> > update-cache.c:  22f3ccd47db4f0888901109a8cbf883d272d1cba
> > --- 22f3ccd47db4f0888901109a8cbf883d272d1cba/update-cache.c
> > +++ uncommitted/update-cache.c
> > @@ -202,6 +202,7 @@
> >                         printf("%s: needs update\n", ce->name);
> >                         continue;
> >                 }
> > +               free(active_cache[i]);
> >                 active_cache[i] = new;
> >         }
> >  }
> 
> FYI, new could've contained active_cache[i] at that time, so you needed
> to check for that. Fixed though, thanks for pointing it out.
> 

Urk, no, please drop.  As Ingo pointed out, the memory was obtained via
mmap ...


-- 
Martin Schlemmer


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Re: Plug memory leak in update-cache.c
  2005-04-16  0:00   ` Martin Schlemmer
@ 2005-04-16  0:04     ` Petr Baudis
  0 siblings, 0 replies; 4+ messages in thread
From: Petr Baudis @ 2005-04-16  0:04 UTC (permalink / raw
  To: Martin Schlemmer; +Cc: GIT Mailing Lists

Dear diary, on Sat, Apr 16, 2005 at 02:00:21AM CEST, I got a letter
where Martin Schlemmer <azarah@nosferatu.za.org> told me that...
> On Sat, 2005-04-16 at 01:48 +0200, Petr Baudis wrote:
> > Dear diary, on Thu, Apr 14, 2005 at 10:53:50AM CEST, I got a letter
> > where Martin Schlemmer <azarah@nosferatu.za.org> told me that...
> > > Hi,
> > > 
> > > Might not be that an big an issue as it should be freed on exit, but
> > > might cause problems with big trees.
> > > 
> > > ----
> > > 
> > > Plug memory leak in update-cache.c.
> > > 
> > > Signed-off-by: Martin Schlemmer <azarah@nosferatu.za.org>
> > > 
> > > update-cache.c:  22f3ccd47db4f0888901109a8cbf883d272d1cba
> > > --- 22f3ccd47db4f0888901109a8cbf883d272d1cba/update-cache.c
> > > +++ uncommitted/update-cache.c
> > > @@ -202,6 +202,7 @@
> > >                         printf("%s: needs update\n", ce->name);
> > >                         continue;
> > >                 }
> > > +               free(active_cache[i]);
> > >                 active_cache[i] = new;
> > >         }
> > >  }
> > 
> > FYI, new could've contained active_cache[i] at that time, so you needed
> > to check for that. Fixed though, thanks for pointing it out.
> > 
> 
> Urk, no, please drop.  As Ingo pointed out, the memory was obtained via
> mmap ...

Yes, I've just noticed that. ;-)

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-04-16  0:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-04-14  8:53 Plug memory leak in update-cache.c Martin Schlemmer
2005-04-15 23:48 ` Petr Baudis
2005-04-16  0:00   ` Martin Schlemmer
2005-04-16  0:04     ` Petr Baudis

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).