diff --git a/checkin_notes b/checkin_notes index bd96bb28dc..bd963e6722 100644 --- a/checkin_notes +++ b/checkin_notes @@ -3098,3 +3098,12 @@ David 27 Mar 2012 boinc_api.h client/ app_control.cpp + +David 27 Mar 2012 + - client: fix bug in reading reason for temporary exit + - lib: fix a valgrind warning + + lib/ + parse.cpp + client/ + app_control.cpp diff --git a/client/app_control.cpp b/client/app_control.cpp index 872e341a40..c8346d8959 100644 --- a/client/app_control.cpp +++ b/client/app_control.cpp @@ -531,9 +531,9 @@ bool ACTIVE_TASK::temporary_exit_file_present(double& x, char* buf) { sprintf(path, "%s/%s", slot_dir, TEMPORARY_EXIT_FILE); FILE* f = fopen(path, "r"); if (!f) return false; + strcpy(buf, ""); int y; int n = fscanf(f, "%d", &y); - fclose(f); if (n != 1 || y < 0 || y > 86400) { x = 300; } else { @@ -542,6 +542,7 @@ bool ACTIVE_TASK::temporary_exit_file_present(double& x, char* buf) { fgets(buf, 256, f); // read the \n fgets(buf, 256, f); strip_whitespace(buf); + fclose(f); return true; } diff --git a/lib/parse.cpp b/lib/parse.cpp index 404b520561..de288c7377 100644 --- a/lib/parse.cpp +++ b/lib/parse.cpp @@ -401,7 +401,7 @@ void xml_escape(const char* in, char* out, int len) { // Note: XML unescaping never increases string length // void xml_unescape(string& in) { - int n = (int)in.size()+1; + int n = (int)in.size()+1+16; // +16 avoids valgrind warnings char* buf = (char*)malloc(n); strcpy(buf, in.c_str()); xml_unescape(buf);