Skip to content
  • Pedro Alves's avatar
    Fix leak in mdebugread.c · 36cb7237
    Pedro Alves authored
    Coverity points out that all the "continue;" statements in the switch
    case in parse_partial_symbols leak STABSTRING.  This is because we
    only release STABSTRING at the end of the scope, with:
    
         	     	  if (stabstring
    		    && stabstring != debug_info->ss + fh->issBase + sh.iss)
    		  xfree (stabstring);
    
    but that bit of code is skipped if a case in the switch statement ends
    with "continue".
    
    Fix this by using gdb::unique_xmalloc_ptr to manage the heap-allocated
    version of 'stabsstring'.
    
    I don't know how to test this.
    
    gdb/ChangeLog:
    2019-01-10  Pedro Alves  <palves@redhat.com>
    
    	* mdebugread.c (parse_partial_symbols): Use
    	gdb::unique_xmalloc_ptr to manage heap-allocated 'stabsstring'.
    36cb7237
To find the state of this project's repository at the time of any of these versions, check out the tags.