• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: malloc during selectAll -> crash
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: malloc during selectAll -> crash


  • Subject: Re: malloc during selectAll -> crash
  • From: Nick Zitzmann <email@hidden>
  • Date: Thu, 11 May 2006 08:27:44 -0600


On May 11, 2006, at 8:16 AM, Lorenzo wrote:

    unsigned int  i, totItems = [selectedRows count];
    if(totItems  == 0) return items ;

unsigned int *buf = malloc(totItems);

Try changing that last line to: unsigned int *buf = malloc(totItems * sizeof(unsigned int))

malloc() takes an argument that specifies the number of bytes you want, but each unsigned int is 4 bytes long.

Nick Zitzmann
<http://www.chronosnet.com/>


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >malloc during selectAll -> crash (From: Lorenzo <email@hidden>)

  • Prev by Date: malloc during selectAll -> crash
  • Next by Date: Re: malloc during selectAll -> crash
  • Previous by thread: malloc during selectAll -> crash
  • Next by thread: Re: malloc during selectAll -> crash
  • Index(es):
    • Date
    • Thread