Passenger: Passenger::MemZeroGuard Class Reference

# Passenger::MemZeroGuard Class Reference

Fills the given memory space or string with zeroes when a MemoryZeroGuard object is destroyed. More...

`#include <Utils.h>`

List of all members.

## Public Member Functions
| MemZeroGuard (void *data, unsigned int size)
| Creates a new MemZeroGuard object with a memory region to zero.
| MemZeroGuard (string &str)
| Creates a new MemoryZeroGuard object with a string to zero.
void | zeroNow ()
| Zero the data immediately.

## Detailed Description

Fills the given memory space or string with zeroes when a MemoryZeroGuard object is destroyed.

Useful for ensuring that buffers containing password data or other sensitive information is cleared when it goes out of scope.

## Constructor & Destructor Documentation

Passenger::MemZeroGuard::MemZeroGuard | ( | void * | data,
|  | unsigned int | size |
| ) |  |  | `[inline]`

Creates a new MemZeroGuard object with a memory region to zero.

Parameters:

  | data | The data to zero after destruction.
  | size | The size of the data.

Precondition:
  data != NULL

Passenger::MemZeroGuard::MemZeroGuard | ( | string & | str | ) | `[inline]`

Creates a new MemoryZeroGuard object with a string to zero.

Parameters:

  | str | The string to zero after destruction.

## Member Function Documentation

void Passenger::MemZeroGuard::zeroNow | ( |  | ) | `[inline]`

Zero the data immediately.

The data will still be zeroed after destruction of this object.

The documentation for this class was generated from the following file:

- Utils.h