Patchwork [libfortran] PR 51090 Check getenv result before proceeding

login
register
mail settings
Submitter Janne Blomqvist
Date Nov. 11, 2011, 4:33 p.m.
Message ID <CAO9iq9EdRjcPa4F=dGz8ubNZvJh786ODVJaXvmaz_uwEt3pw4g@mail.gmail.com>
Download mbox | patch
Permalink /patch/125210/
State New
Headers show

Comments

Janne Blomqvist - Nov. 11, 2011, 4:33 p.m.
Hi,

committed the patch below as obvious.

2011-11-11  Janne Blomqvist  <jb@gcc.gnu.org>

	PR libfortran/51090
	* runtime/main.c (find_addr2line): NULL check before proceeding.

Patch

Index: main.c
===================================================================
--- main.c      (revision 181287)
+++ main.c      (working copy)
@@ -149,6 +149,8 @@  find_addr2line (void)
 #ifdef HAVE_ACCESS
 #define A2L_LEN 10
   char *path = getenv ("PATH");
+  if (!path)
+      return;
   size_t n = strlen (path);
   char ap[n + 1 + A2L_LEN];
   size_t ai = 0;