Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
C28105
Collapse the table of content
Expand the table of content

C28105

Warning C28105: Leaking resource due to an exception

The specified resource is not freed when an exception is raised. The statement specified by the path can raise an exception. This warning is similar to warning C28103, except that in this case an exception is involved.

The following code example generates this warning:

res = KeSaveFloatingPointState(buffer);

res = AllocateResource(Resource);
char *p2 = new char[10]; // could throw

delete[] p2;
FreeResource(Resource)

The following code example avoids this warning:

res = AllocateResource(Resource);
char *p2;

try {
    p2 = new char[10];
} catch (std::bad_alloc *e) {
    // just handle the throw
    ;
}
FreeResource(Resource)
Show:
© 2015 Microsoft