Rama Kunapuli - 2023-04-03

Have the following simple code:
void test()
{

            try {

                            char *p = malloc(100);

                            if (p == NULL)

                                            throw 1;

            } catch(int x) {

                            if (x)

                                            printf("\n error");

            }

//dostuff(p);
If I run cppcheck, it indicates no memory leaks which is incorrect as "p" variable is never allocated.

However, if I comment out the try catch block, cppcheck works correct;ly.
If I run the same sample without try-catch block, it shows
error: Memory leak: p[memleak]