An error occurred while fetching this tab.
E3-1197: Fix possible memory issues
- May 10, 2023
-
-
Lucas Magalhães authored
-
Lucas Magalhães authored
This was reported by cppcheck over require's code: require-ess/src/runScript.c:128:12: error: Common realloc mistake: 'line_raw' nulled but not freed upon failure [memleakOnRealloc] if ((line_raw = realloc(line_raw, line_raw_size *= 2)) == NULL) ^ Unfortunately realloc can return null, in that case if we use something like line_raw = realloc(line_raw, size); The memory pointed by line_raw is lost.
640e5721 -
Lucas Magalhães authored
This was reported running cppcheck over require's code. require-ess/src/require.c:1002:33: error: Uninitialized variable: &modulediroffs [uninitvar] dirname, module, &modulediroffs); ^ require-ess/src/require.c:996:18: note: Assuming condition is false if (dirlen == 0) continue; /* ignore empty driverpath elements */ ^ require-ess/src/require.c:1002:33: note: Uninitialized variable: &modulediroffs dirname, module, &modulediroffs); ^
b2085515 -
Lucas Magalhães authored
In function ‘compareVersions’, inlined from ‘require_priv’ at .././src/require.c:1025:29: .././src/require.c:640:9: warning: ‘%s’ directive argument is null [-Wformat-overflow=] 640 | debug("require: compareVersions(found=%s, request=%s)\n", found, request); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .././src/require.c:601:28: note: in definition of macro ‘debug’ 601 | if (requireDebug) printf(__VA_ARGS__) | ^~~~~~~~~~~ .././src/require.c: In function ‘require_priv’: .././src/require.c:640:53: note: format string is defined here 640 | debug("require: compareVersions(found=%s, request=%s)\n", found, request); | ^~ In function ‘compareVersions’, inlined from ‘require_priv’ at .././src/require.c:1025:29: .././src/require.c:640:9: warning: ‘%s’ directive argument is null [-Wformat-overflow=] 640 | debug("require: compareVersions(found=%s, request=%s)\n", found, request); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .././src/require.c:601:28: note: in definition of macro ‘debug’ 601 | if (requireDebug) printf(__VA_ARGS__) | ^~~~~~~~~~~ .././src/require.c: In function ‘require_priv’: .././src/require.c:640:53: note: format string is defined here 640 | debug("require: compareVersions(found=%s, request=%s)\n", found, request); | ^~ .././src/require.c:1031:50: warning: ‘%s’ directive argument is null [-Wformat-overflow=] 1031 | printf("require: %s %s may match %s\n", module, currentFilename, | ^~
875791dc -
Lucas Magalhães authoredfd05d245
-