File: lib_cppcheck.patch

package info (click to toggle)
boinc 8.2.5%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 110,632 kB
  • sloc: cpp: 178,901; php: 115,537; pascal: 56,058; ansic: 49,303; xml: 17,863; python: 8,756; javascript: 6,538; sh: 5,800; makefile: 2,254; objc: 1,867; perl: 1,843; sql: 831; java: 429; lisp: 47; csh: 30
file content (17 lines) | stat: -rw-r--r-- 566 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Description: this patch adds a checks for enough free memory, and exits in case of not enough.
--- a/lib/unix_util.cpp
+++ b/lib/unix_util.cpp
@@ -80,7 +80,13 @@
             }
             if (i!=envstrings.end()) {
                 // we allocated this string.  Reallocate it.
+		char *b=buf;
                 buf=(char *)realloc(buf,strlen(name)+strlen(value)+2);
+		if (!buf) {
+		    free(b);
+		    errno=ENOMEM;
+		    return -1;
+		}
                 *i=buf;
             } else {
                 // someone else allocated the string.  Allocate new memory.