Skip to contentSkip to conversation

Plug memory leak in update-cache.c

PATCH Martin Schlemmer 2 participants 4 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

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.

update-cache.c: 22f3ccd47db4f0888901109a8cbf883d272d1cba

update-cache.c +1 -0
@@ -202,6 +202,7 @@
                        printf("%s: needs update\n", ce->name);
                        continue;
                }
+               free(active_cache[i]);
                active_cache[i] = new;
        }
 }
Signature · 1 line
Martin Schlemmer

update-cache.c: 22f3ccd47db4f0888901109a8cbf883d272d1cba

update-cache.c +1 -0
@@ -202,6 +202,7 @@
 			printf("%s: needs update\n", ce->name);
 			continue;
 		}
+		free(active_cache[i]);
 		active_cache[i] = new;
 	}
 }
#1 lore raw

Dear diary, on Thu, Apr 14, 2005 at 10:53:50AM CEST, I got a letter where Martin Schlemmer <[email protected]> told me that...

Quoted 15 lines

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.

update-cache.c: 22f3ccd47db4f0888901109a8cbf883d272d1cba

update-cache.c line 208

Quoted 7 lines
update-cache.c +1 -0
@@ -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.

Signature · 3 lines
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor
#2 lore raw
Quoted 13 lines · Petr Baudis

Dear diary, on Thu, Apr 14, 2005 at 10:53:50AM CEST, I got a letter where Martin Schlemmer <[email protected]> told me that...

Quoted 11 lines

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.

Quoted 15 lines

update-cache.c line 208

Quoted 11 lines

update-cache.c: 22f3ccd47db4f0888901109a8cbf883d272d1cba

update-cache.c +1 -0
@@ -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 ...

Signature · 1 line
Martin Schlemmer
#3 lore raw

Dear diary, on Sat, Apr 16, 2005 at 02:00:21AM CEST, I got a letter where Martin Schlemmer <[email protected]> told me that...

Quoted 30 lines · Petr Baudis
Quoted 13 lines

Dear diary, on Thu, Apr 14, 2005 at 10:53:50AM CEST, I got a letter where Martin Schlemmer <[email protected]> told me that...

Quoted 11 lines

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.

Quoted 15 lines

update-cache.c line 208

Quoted 11 lines

update-cache.c: 22f3ccd47db4f0888901109a8cbf883d272d1cba

update-cache.c +1 -0
@@ -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.

Quoted 2 lines

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

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

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