Sonarqube not reporting memory leaks issues


Sonarqube not detecting memory leaks in the code even though all rules are activated in the quality profile .I am using sonarqube 7.6
Can you suggest how to fix this

Below is my code

#include <stdio.h>
#include <unistd.h>
#define BUFSIZE1 512
#define BUFSIZE2 ((BUFSIZE1/2) - 8)

int main(int argc, char **argv) {
char *buf1R1;
char *buf2R1;
char *buf1R2;
buf1R1 = (char *) malloc(BUFSIZE2);
buf2R1 = (char *) malloc(BUFSIZE2);
buf1R2 = (char *) malloc(BUFSIZE1);
strncpy(buf1R2, argv[1], BUFSIZE1-1);


Hi Dhanush,

Please don’t double post. You’ve both opened this new thread and resurrected an old thread with the same content. Since you got an answer in the old thread, I’m closing this one.


Hi Dhanush,

It seems I owe you a sincere apology. Massimo has told me he asked you to open this thread, so I’m reopening it. Please forgive my apparent over-reaction and my not reading his reply to you.


Hi @Dhanush_KC,

could you try updating the SonarCFamily analyzer to version 6.2 and check if the issue is still not raised?

Thanks for the Reply

Is SonarCFamily version 6.2 licensed one?
I am using sonar-c-plugin- plugin

Hello @Dhanush_KC,

I am sorry but if you are not using the licensed plugin I cannot help you, please refer to the correct channel for the non licensed plugin.
BTW, the licensed analyser can raise issues on the snippet of code you provided.

1 Like