comparison src/xrdb.c @ 17572:73d867b4a654

(get_user_app): Free the gethomedir value.
author Richard M. Stallman <rms@gnu.org>
date Sun, 27 Apr 1997 03:18:20 +0000
parents ee40177f6c68
children 42c1854d17fb
comparison
equal deleted inserted replaced
17571:e4c551837753 17572:73d867b4a654
401 get_user_app (class) 401 get_user_app (class)
402 char *class; 402 char *class;
403 { 403 {
404 char *path; 404 char *path;
405 char *file = 0; 405 char *file = 0;
406 char *free_it = 0;
406 407
407 /* Check for XUSERFILESEARCHPATH. It is a path of complete file 408 /* Check for XUSERFILESEARCHPATH. It is a path of complete file
408 names, not directories. */ 409 names, not directories. */
409 if (((path = getenv ("XUSERFILESEARCHPATH")) 410 if (((path = getenv ("XUSERFILESEARCHPATH"))
410 && (file = search_magic_path (path, class, 0, 0))) 411 && (file = search_magic_path (path, class, 0, 0)))
415 && ((file = search_magic_path (path, class, "/%L/%N", 0)) 416 && ((file = search_magic_path (path, class, "/%L/%N", 0))
416 || (file = search_magic_path (path, class, "/%N", 0)))) 417 || (file = search_magic_path (path, class, "/%N", 0))))
417 418
418 /* Check in the home directory. This is a bit of a hack; let's 419 /* Check in the home directory. This is a bit of a hack; let's
419 hope one's home directory doesn't contain any %-escapes. */ 420 hope one's home directory doesn't contain any %-escapes. */
420 || (path = gethomedir (), 421 || (free_it = gethomedir (),
421 ((file = search_magic_path (path, class, "%L/%N", 0)) 422 ((file = search_magic_path (free_it, class, "%L/%N", 0))
422 || (file = search_magic_path (path, class, "%N", 0))))) 423 || (file = search_magic_path (free_it, class, "%N", 0)))))
423 { 424 {
424 XrmDatabase db = XrmGetFileDatabase (file); 425 XrmDatabase db = XrmGetFileDatabase (file);
425 free (file); 426 free (file);
427 if (free_it)
428 free (free_it);
426 return db; 429 return db;
427 } 430 }
428 else 431
429 return NULL; 432 if (free_it)
433 free (free_it);
434 return NULL;
430 } 435 }
431 436
432 437
433 static XrmDatabase 438 static XrmDatabase
434 get_user_db (display) 439 get_user_db (display)