SonarSource/sonar-scanning-examples

Sonar Scanner not reporting memory leaks issues for c project

dhanushkc opened this issue · 2 comments

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);
}

Even though all 4.7k+ rules are activated sonarqube 7.6 not detecting memory leak issues

facing the same issue. When I try to scan a single test-leak.c file. It correctly reports the leak. However for a project built with build-wrapper, it just shows the code smells and nothing else.

This repo is only to show how to scan.
Opening an issue on that repo is not the right way to report supposed limitations of SonarQube analyzers. Please go to https://community.sonarsource.com