Source-Changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: CVS commit: syssrc/sys/uvm
Andrew Brown <atatat%netbsd.org@localhost> writes:
> cvs rdiff -r1.45 -r1.46 syssrc/sys/uvm/uvm_amap.c
@@ -385,6 +476,11 @@
newover = malloc(slotalloc * sizeof(struct vm_anon *), M_UVMAMAP,
M_WAITOK | M_CANFAIL);
if (newsl == NULL || newbck == NULL || newover == NULL) {
+#ifdef UVM_AMAP_PPREF
+ if (newppref != NULL) {
+ free(amap->am_ppref, M_UVMAMAP);
+ }
+#endif
if (newsl != NULL) {
free(newsl, M_UVMAMAP);
}
- At this point, newppref isn't assigned to amap->am_ppref yet.
- I guess we can defer the deallocation of amap->am_ppref when failed
to allocate newppref so that it remains unchanged if we return
ENOMEM.
enami.
Index: uvm_amap.c
===================================================================
RCS file: /cvsroot/syssrc/sys/uvm/uvm_amap.c,v
retrieving revision 1.46
diff -u -r1.46 uvm_amap.c
--- uvm_amap.c 2002/11/14 17:58:49 1.46
+++ uvm_amap.c 2002/11/15 07:33:30
@@ -463,10 +463,6 @@
if (amap->am_ppref && amap->am_ppref != PPREF_NONE) {
newppref = malloc(slotalloc * sizeof(int), M_UVMAMAP,
M_WAITOK | M_CANFAIL);
- if (newppref == NULL) {
- free(amap->am_ppref, M_UVMAMAP);
- amap->am_ppref = PPREF_NONE;
- }
}
#endif
newsl = malloc(slotalloc * sizeof(int), M_UVMAMAP,
@@ -478,7 +474,7 @@
if (newsl == NULL || newbck == NULL || newover == NULL) {
#ifdef UVM_AMAP_PPREF
if (newppref != NULL) {
- free(amap->am_ppref, M_UVMAMAP);
+ free(newppref, M_UVMAMAP);
}
#endif
if (newsl != NULL) {
@@ -562,7 +558,8 @@
pp_setreflen(newppref, slotalloc - slotneed, 1,
slotneed - slotmapped);
}
- }
+ } else
+ amap->am_ppref = PPREF_NONE;
#endif
/* update master values */
Home |
Main Index |
Thread Index |
Old Index