unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Problem report #50
@ 2006-04-09  7:00 Dan Nicolaescu
  2006-04-10  9:35 ` Andreas Schwab
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Nicolaescu @ 2006-04-09  7:00 UTC (permalink / raw)




ERROR
CID: 50
Checker: REVERSE_INULL (help)
File: emacs/src/xrdb.c
Function: get_user_app
Description: Pointer "free_it" dereferenced before NULL check

Event deref_ptr_in_call: Dereferences pointer "free_it" [model]
Also see events: [check_after_deref]
At conditional (1): "file = search_magic_path != 0" taking false path
At conditional (2): "file = search_magic_path != 0" taking false path

419  	  if (((path = getenv ("XUSERFILESEARCHPATH"))
420  	       && (file = search_magic_path (path, class, 0, 0)))
421  	
422  	      /* Check for APPLRESDIR; it is a path of directories.  In each,
423  		 we have to search for LANG/CLASS and then CLASS.  */
424  	      || ((path = getenv ("XAPPLRESDIR"))
425  		  && ((file = search_magic_path (path, class, "/%L/%N", 0))
426  		      || (file = search_magic_path (path, class, "/%N", 0))))
427  	
428  	      /* Check in the home directory.  This is a bit of a hack; let's
429  		 hope one's home directory doesn't contain any %-escapes.  */
430  	      || (free_it = gethomedir (),
431  		  ((file = search_magic_path (free_it, class, "%L/%N", 0))
432  		   || (file = search_magic_path (free_it, class, "%N", 0)))))
433  	    {
434  	      XrmDatabase db = XrmGetFileDatabase (file);
435  	      free (file);
436  	      if (free_it)
437  		free (free_it);
438  	      return db;
439  	    }
440  	

Event check_after_deref: Pointer "free_it" dereferenced before NULL check
Also see events: [deref_ptr_in_call]

441  	  if (free_it)
442  	    free (free_it);
443  	  return NULL;
444  	}
445 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Problem report #50
  2006-04-09  7:00 Problem report #50 Dan Nicolaescu
@ 2006-04-10  9:35 ` Andreas Schwab
  0 siblings, 0 replies; 2+ messages in thread
From: Andreas Schwab @ 2006-04-10  9:35 UTC (permalink / raw)


Dan Nicolaescu <dann@ics.uci.edu> writes:

> 428  	      /* Check in the home directory.  This is a bit of a hack; let's
> 429  		 hope one's home directory doesn't contain any %-escapes.  */
> 430  	      || (free_it = gethomedir (),
> 431  		  ((file = search_magic_path (free_it, class, "%L/%N", 0))
> 432  		   || (file = search_magic_path (free_it, class, "%N", 0)))))
> 433  	    {
> 434  	      XrmDatabase db = XrmGetFileDatabase (file);
> 435  	      free (file);
> 436  	      if (free_it)
> 437  		free (free_it);
> 438  	      return db;
> 439  	    }
> 440  	
>
> Event check_after_deref: Pointer "free_it" dereferenced before NULL check
> Also see events: [deref_ptr_in_call]

This is wrong, since gethomedir always returns non-NULL (but not always a
heap pointer, which i've fixed now).

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-04-10  9:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-09  7:00 Problem report #50 Dan Nicolaescu
2006-04-10  9:35 ` Andreas Schwab

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).