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.
Example
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)