Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
871 B

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1996 - 1999
  6. //
  7. // File: new.cpp
  8. //
  9. // Contents: new and delete operators.
  10. //
  11. // History: 16-Jan-97 kevinr created
  12. //
  13. //--------------------------------------------------------------------------
  14. #include "global.hxx"
  15. //--------------------------------------------------------------------------
  16. //
  17. //--------------------------------------------------------------------------
  18. extern void * __cdecl operator new(
  19. IN size_t cb)
  20. {
  21. void *pv;
  22. if (NULL == (pv = malloc(cb)))
  23. goto mallocError;
  24. ErrorReturn:
  25. return pv;
  26. SET_ERROR(mallocError,ERROR_NOT_ENOUGH_MEMORY)
  27. }
  28. void __cdecl operator delete(
  29. IN void *pv)
  30. {
  31. if (pv)
  32. free(pv);
  33. }