diff --git a/checkin_notes b/checkin_notes index e021dddc56..90f6a732b5 100644 --- a/checkin_notes +++ b/checkin_notes @@ -6554,3 +6554,18 @@ David 1 Nov 2012 common_defs.h filesys.h gui_rpc_client.h + +David 1 Nov 2012 + - fix a few unlikely but possible file-descriptor leaks + - remote job submission: always compute fraction done when showing + batch list; check for nonexistent user + + client/ + cs_scheduler.cpp + html/user/ + submit.php + lib/ + cert_sig.cpp + mem_usage.cpp + sched/ + sched_timezone.cpp diff --git a/client/cs_scheduler.cpp b/client/cs_scheduler.cpp index c59683624c..133172e32f 100644 --- a/client/cs_scheduler.cpp +++ b/client/cs_scheduler.cpp @@ -369,6 +369,7 @@ int CLIENT_STATE::make_scheduler_request(PROJECT* p) { fprintf(f, "\n\n\n"); + fclose(cof); } fprintf(f, "\n"); diff --git a/html/user/submit.php b/html/user/submit.php index 8496d89a88..03599abe9c 100644 --- a/html/user/submit.php +++ b/html/user/submit.php @@ -31,7 +31,7 @@ ini_set('display_startup_errors', true); // function show_batches($batches) { foreach ($batches as $batch) { - if ($batch->state < BATCH_STATE_COMPLETE) { + if ($batch->state < BATCH_STATE_COMPLETE || $batch->fraction_done < 1) { $wus = BoincWorkunit::enum("batch = $batch->id"); $batch = get_batch_params($batch, $wus); } @@ -42,7 +42,11 @@ function show_batches($batches) { $batch->app_name = "unknown"; } $user = BoincUser::lookup_id($batch->user_id); - $batch->user_name = $user->name; + if ($user) { + $batch->user_name = $user->name; + } else { + $batch->user_name = "missing user $batch->user_id"; + } } $first = true; diff --git a/lib/cert_sig.cpp b/lib/cert_sig.cpp index 7c193e4ec9..389579e426 100644 --- a/lib/cert_sig.cpp +++ b/lib/cert_sig.cpp @@ -150,6 +150,7 @@ int CERT_SIGS::parse_file(const char* filename) { mf.init_file(f); XML_PARSER xp(&mf); if (!xp.parse_start("signatures")) { + fclose(f); return ERR_XML_PARSE; } retval = this->parse(xp); diff --git a/lib/mem_usage.cpp b/lib/mem_usage.cpp index c46bdc7f50..5bde610338 100644 --- a/lib/mem_usage.cpp +++ b/lib/mem_usage.cpp @@ -118,6 +118,7 @@ int mem_usage(double& vm_usage, double& resident_set) { ++p; // move past space } if (!p) { + fclose(f); return ERR_NOT_IMPLEMENTED; } diff --git a/sched/sched_timezone.cpp b/sched/sched_timezone.cpp index e7336450f2..b2c843e0b2 100644 --- a/sched/sched_timezone.cpp +++ b/sched/sched_timezone.cpp @@ -124,14 +124,18 @@ URLTYPE* read_download_list() { } // read in lines from file + // while (1) { // allocate memory in blocks if ((count % BLOCKSIZE)==0) { cached=(URLTYPE *)realloc(cached, (count+BLOCKSIZE)*sizeof(URLTYPE)); - if (!cached) return NULL; + if (!cached) { + fclose(fp); + return NULL; + } } - // read timezone offset and URL from file, and store in cache - // list + // read timezone offset and URL from file, and store in cache list + // if (2==fscanf(fp, "%d %s", &(cached[count].zone), cached[count].name)) { count++; } else {