aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeffrey Armstrong <jeff@approximatrix.com>2020-05-06 20:44:08 -0400
committerJeffrey Armstrong <jeff@approximatrix.com>2020-05-06 20:44:08 -0400
commitb3b8506ef0ce1200cd1f50455ff4a81deb8bd74e (patch)
tree8fae293c001b71da3fc0ca43d41c5d618d5190c5
parent09a2a56e22ce36238dce94f927f1909b63493960 (diff)
downloadLR-87-b3b8506ef0ce1200cd1f50455ff4a81deb8bd74e.tar.gz
LR-87-b3b8506ef0ce1200cd1f50455ff4a81deb8bd74e.zip
Some minor memory safety improvements
-rw-r--r--main.F9016
-rw-r--r--render.f902
2 files changed, 12 insertions, 6 deletions
diff --git a/main.F90 b/main.F90
index 13ff29a..9610207 100644
--- a/main.F90
+++ b/main.F90
@@ -68,7 +68,7 @@ implicit none
do while(running)
if(index(current_url, "gemini://") /= 1) then
- call r%draw_error("Only gemini:// URLs are supported")
+ call r%draw_error("Only gemini:// URLs supported ("//trim(current_url)//")")
populated = .false.
loaded = .true.
return_code = STATUS_LOCALFAIL
@@ -129,12 +129,16 @@ implicit none
case (render_action_back)
call back_location(locations_visited, current_url)
- call free_lines(first_line)
+ if(associated(first_line)) then
+ call free_lines(first_line)
+ end if
loaded = .false.
case (render_action_layout)
- call r%report_status("Performing Layout")
- call layout_lines(first_line, r)
+ if(associated(first_line)) then
+ call r%report_status("Performing Layout")
+ call layout_lines(first_line, r)
+ end if
case (render_action_goto)
@@ -144,7 +148,9 @@ implicit none
call handle_relative_url(current_url, input)
end if
- call free_lines(first_line)
+ if(associated(first_line)) then
+ call free_lines(first_line)
+ end if
loaded = .false.
end select
diff --git a/render.f90 b/render.f90
index 0045c22..d723467 100644
--- a/render.f90
+++ b/render.f90
@@ -212,7 +212,7 @@ contains
do while(w > r%max_width)
endpos = endpos - 1
- do while(text(endpos:endpos) /= ' ' .and. text(endpos:endpos) /= '-')
+ do while(text(endpos:endpos) /= ' ' .and. text(endpos:endpos) /= '-' .and. endpos > my_start)
endpos = endpos - 1
end do