changeset 4404:80e07b006f9c

Prevent access to uninitialized variables in x_init_device. 2008-01-18 Jerry James <james@xemacs.org> * device-x.c (x_init_device): Don't write to path or read from format when neither has been initialized.
author Jerry James <james@xemacs.org>
date Fri, 18 Jan 2008 16:12:31 -0700
parents 7080e020d700
children 4b62544f5139
files src/ChangeLog src/device-x.c
diffstat 2 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Thu Jan 17 21:02:42 2008 -0500
+++ b/src/ChangeLog	Fri Jan 18 16:12:31 2008 -0700
@@ -1,3 +1,8 @@
+2008-01-18  Jerry James  <james@xemacs.org>
+
+	* device-x.c (x_init_device): Don't write to path or read from
+	format when neither has been initialized.
+
 2008-01-16  Aidan Kehoe  <kehoea@parhasard.net>
 
 	* elhash.c (internal_hash):
--- a/src/device-x.c	Thu Jan 17 21:02:42 2008 -0500
+++ b/src/device-x.c	Fri Jan 18 16:12:31 2008 -0700
@@ -703,6 +703,10 @@
 	path = alloca_extbytes (strlen (data_dir) + 13 + strlen (locale) + 7);
 	format = "%sapp-defaults/%s/Emacs";
       }
+    else
+      {
+	goto no_data_directory;
+      }
 
     /*
      * The general form for $LANG is <language>_<country>.<encoding>.  Try
@@ -730,6 +734,7 @@
 	XrmCombineFileDatabase (path, &db, False);
     }
 
+  no_data_directory:
     xfree (locale, Extbyte*);
  }
 #endif /* MULE */