Fix a memory leak
Modified: trunk/reactos/drivers/lib/oskittcp/oskittcp/tcp_output.c
_____
Modified: trunk/reactos/drivers/lib/oskittcp/oskittcp/tcp_output.c
--- trunk/reactos/drivers/lib/oskittcp/oskittcp/tcp_output.c
2006-01-01 11:34:59 UTC (rev 20502)
+++ trunk/reactos/drivers/lib/oskittcp/oskittcp/tcp_output.c
2006-01-01 11:41:05 UTC (rev 20503)
@@ -69,7 +69,6 @@
#define IS_LOOPBACK_ADDR(addr) \
((ntohl(addr) & IN_CLASSA_NET) == (IN_LOOPBACKNET <<
IN_CLASSA_NSHIFT))
-
/*
* Tcp output routine: figure out what should be sent and send it.
*/
@@ -87,6 +86,9 @@
int idle, sendalot;
struct rmxp_tao *taop;
struct rmxp_tao tao_noncached;
+#ifdef __REACTOS__
+ struct mbuf *n;
+#endif
OS_DbgPrint(OSK_MID_TRACE,("Called\n"));
@@ -732,6 +734,18 @@
#endif
error = ip_output(m, tp->t_inpcb->inp_options,
&tp->t_inpcb->inp_route,
so->so_options & SO_DONTROUTE, 0);
+#ifdef __REACTOS__
+ /* We allocated m, so we are responsible for freeing it. If the
mbuf
+ contains a pointer to an external datablock, we (or rather,
m_copy)
+ didn't allocate it but pointed it to the data to send. So we
have
+ to cheat a little bit and keep M_FREE from freeing the
external
+ data block */
+ while (NULL != m) {
+ m->m_flags &= ~M_EXT;
+ MFREE(m, n);
+ m = n;
+ }
+#endif
}
if (error) {
out:
Revert part of r20493. Created bug 1229 to keep track of the issue.
Modified: trunk/reactos/ntoskrnl/mm/pagefile.c
Modified: trunk/reactos/subsys/smss/initpage.c
_____
Modified: trunk/reactos/ntoskrnl/mm/pagefile.c
--- trunk/reactos/ntoskrnl/mm/pagefile.c 2006-01-01 01:09:08 UTC
(rev 20498)
+++ trunk/reactos/ntoskrnl/mm/pagefile.c 2006-01-01 10:24:27 UTC
(rev 20499)
@@ -16,8 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-/* $Id$
- *
+/*
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/mm/pagefile.c
* PURPOSE: Paging file functions
@@ -897,22 +896,18 @@
BytesPerAllocationUnit = FsSizeInformation.SectorsPerAllocationUnit
*
FsSizeInformation.BytesPerSector;
-
- /* We have to find a value which is a multiple of both PAGE_SIZE and
- BytesPerAllocationUnit */
- SafeInitialSize.u.LowPart = ((SafeInitialSize.u.LowPart + PAGE_SIZE
- 1) /
- PAGE_SIZE) * PAGE_SIZE;
- while (0 != (SafeInitialSize.u.LowPart % BytesPerAllocationUnit) &&
- SafeInitialSize.u.LowPart <= SafeMaximumSize.u.LowPart -
PAGE_SIZE)
+ /* FIXME: If we have 2048 BytesPerAllocationUnit (FAT16 < 128MB)
there is
+ * a problem if the paging file is fragmented. Suppose the first
cluster
+ * of the paging file is cluster 3042 but cluster 3043 is NOT part
of the
+ * paging file but of another file. We can't write a complete page
(4096
+ * bytes) to the physical location of cluster 3042 then. */
+ if (BytesPerAllocationUnit % PAGE_SIZE)
{
- SafeInitialSize.u.LowPart += PAGE_SIZE;
- }
- if (0 != (SafeInitialSize.u.LowPart % BytesPerAllocationUnit))
- {
+ DPRINT1("BytesPerAllocationUnit %d is not a multiple of PAGE_SIZE
%d\n",
+ BytesPerAllocationUnit, PAGE_SIZE);
ZwClose(FileHandle);
- return STATUS_ALLOTTED_SPACE_EXCEEDED;
+ return STATUS_UNSUCCESSFUL;
}
- ASSERT(0 == (SafeInitialSize.u.LowPart % PAGE_SIZE));
Status = ZwSetInformationFile(FileHandle,
&IoStatus,
_____
Modified: trunk/reactos/subsys/smss/initpage.c
--- trunk/reactos/subsys/smss/initpage.c 2006-01-01 01:09:08 UTC
(rev 20498)
+++ trunk/reactos/subsys/smss/initpage.c 2006-01-01 10:24:27 UTC
(rev 20499)
@@ -225,8 +225,8 @@
0);
if (! NT_SUCCESS(Status))
{
- PrintString("Creation of paging file %wZ with size %I64d KB
failed (status 0x%x\n",
- &FileName, InitialSize.QuadPart / 1024);
+ PrintString("Creation of paging file %wZ with size %I64d KB
failed (status 0x%x)\n",
+ &FileName, InitialSize.QuadPart / 1024, Status);
}
Cleanup: