comparison src/os/linux/vm/os_linux.cpp @ 1325:98ba8ca25feb

6936168: Recent fix for unmapping stack guard pages doesn't close /proc/self/maps Summary: Add close to returns (fix for 6929067 also contributed by aph) Reviewed-by: aph, dcubed, andrew, acorn Contributed-by: aph@redhat.com, andreas.kohn@fredhopper.com
author coleenp
date Thu, 18 Mar 2010 16:47:37 -0400
parents 3b3d12e645e7
children a2ea687fdc7c
comparison
equal deleted inserted replaced
1324:e392695de029 1325:98ba8ca25feb
2526 while (!feof(f)) { 2526 while (!feof(f)) {
2527 size_t dummy; 2527 size_t dummy;
2528 char *str = NULL; 2528 char *str = NULL;
2529 ssize_t len = getline(&str, &dummy, f); 2529 ssize_t len = getline(&str, &dummy, f);
2530 if (len == -1) { 2530 if (len == -1) {
2531 fclose(f);
2531 return false; 2532 return false;
2532 } 2533 }
2533 2534
2534 if (len > 0 && str[len-1] == '\n') { 2535 if (len > 0 && str[len-1] == '\n') {
2535 str[len-1] = 0; 2536 str[len-1] = 0;
2541 && (strcmp(str + len - strlen(stack_str), stack_str) == 0)) { 2542 && (strcmp(str + len - strlen(stack_str), stack_str) == 0)) {
2542 if (sscanf(str, "%" SCNxPTR "-%" SCNxPTR, bottom, top) == 2) { 2543 if (sscanf(str, "%" SCNxPTR "-%" SCNxPTR, bottom, top) == 2) {
2543 uintptr_t sp = (uintptr_t)__builtin_frame_address(0); 2544 uintptr_t sp = (uintptr_t)__builtin_frame_address(0);
2544 if (sp >= *bottom && sp <= *top) { 2545 if (sp >= *bottom && sp <= *top) {
2545 free(str); 2546 free(str);
2547 fclose(f);
2546 return true; 2548 return true;
2547 } 2549 }
2548 } 2550 }
2549 } 2551 }
2550
2551 free(str); 2552 free(str);
2552 } 2553 }
2553 2554 fclose(f);
2554 return false; 2555 return false;
2555 } 2556 }
2556 2557
2557 // If the (growable) stack mapping already extends beyond the point 2558 // If the (growable) stack mapping already extends beyond the point
2558 // where we're going to put our guard pages, truncate the mapping at 2559 // where we're going to put our guard pages, truncate the mapping at