# Re: [dev] Memory access violations and leaks

From: Henning Meier-Geinitz (henning@meier-geinitz.de)
Date: Tue May 08 2001 - 12:02:16 PDT

- Next message: Nick Lamb: "Re: EOF detection"
  - Previous message: Henning Meier-Geinitz: "Re: SANE CVS mails"
  - In reply to: abel deuring: "Re: [dev] Memory access violations and leaks"
  - Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

  Hi,

  On Mon, May 07, 2001 at 09:06:56PM +0200, abel deuring wrote:
  > I don't think that this is a memory leak:

  [...]

  The mtrace program just looks if the memory is freed explicitely
  before exiting. If it's allocated only once and not again with every
  call of an often called functionthere is no real need to fix this.

  On the other hand it's not that complicated in the case of the
  sane_get_devices() function so I think we should fix it there.

  > num_alloced is a static variable, initialized to zero, fd_info is a
  > static variable too, hence malloc is only called during the first call
  > of sanei_scsi_open[_extended]. A corresponding call to free is indeed
  > missing, but since the memory block pointed to by fd_info should be
  > available during the entire program run time, we would need to put this
  > into an exit handler function.

  If it's to complicated, don't do it.

  > But fd_info is not properly initialized. I'm quite surprised that this
  > did not cause problems...

  Quite often we find errors we are not searching for :-)

  Bye,
  Henning

      --
      Source code, list archive, and docs: http://www.mostang.com/sane/
      To unsubscribe: echo unsubscribe sane-devel | mail majordomo@mostang.com

  - Next message: Nick Lamb: "Re: EOF detection"
  - Previous message: Henning Meier-Geinitz: "Re: SANE CVS mails"
  - In reply to: abel deuring: "Re: [dev] Memory access violations and leaks"
  - Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

  This archive was generated by hypermail 2b29 : Tue May 08 2001 - 11:51:14 PDT