E3-1197: Fix possible memory issues
Compare changes
- 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.
+ 3
− 1
@@ -49,6 +49,7 @@ int runScript(const char *filename, const char *args) {
@@ -125,8 +126,9 @@ int runScript(const char *filename, const char *args) {