File: lib_cppcheck.patch

package info (click to toggle)
boinc 8.2.6%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 104,688 kB
  • sloc: cpp: 172,875; php: 115,929; pascal: 56,058; xml: 17,863; python: 8,752; javascript: 6,538; sh: 5,343; objc: 2,322; ansic: 2,200; makefile: 2,166; 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.