#include <stdio.h>

void f(int n, int d)
{
    int *p = new int[n];
    try {
        if (d == 0)
            throw 1;
    }
    catch (...) {
        delete[] p;
        throw;
    }
    delete[] p;
}

int main()
{
    try {
        f(5, 0);
    }
    catch (...) {
        fprintf(stderr, "some exception\n");
        return 1;
    }
    return 0;
}
