Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what does this error suggest?

When I am trying to execute my program Its getting error like this -

sendip: malloc.c:4631: _int_malloc: Assertion `(unsigned long)(size)
 >= (unsigned long)(nb)' failed

Tried capturing error through valgrind,got this one -

   HEAP SUMMARY:
   ==3335==     in use at exit: 24 bytes in 2 blocks 
   ==3335==   total heap usage: 111 allocs, 109 frees, 7,929 bytes allocated
   ==3335== 
   ==3335== 4 bytes in 1 blocks are definitely lost in loss record 1 of 2
   ==3335==    at 0x40268A4: malloc (vg_replace_malloc.c:236)
   ==3335==    by 0x8049EEF: main (sendip.c:435)
   ==3335== 
   ==3335== 20 bytes in 1 blocks are definitely lost in loss record 2 of 2
   ==3335==    at 0x40268A4: malloc (vg_replace_malloc.c:236)
   ==3335==    by 0x4031F57: ???
   ==3335==    by 0x804A338: main (sendip.c:521)
   ==3335== 

Line no. 435

              datalen = stringargument(gnuoptarg, &datarg);
      /*This is the line*/ data=(char *)malloc(datalen);
                            memcpy(data, datarg, datalen);

If needed I could add other pieces of code ... but help me getting out of this ??? What is this I am getting no clue ..

like image 478
Udit Gupta Avatar asked Oct 13 '11 19:10

Udit Gupta


People also ask

What is suggestion error?

Information that is required by the Web page but omitted by the user. Information that is provided by the user but that falls outside the required data format or values.

What is being determined when testing 3.3 4 error prevention?

Providing the ability to reverse actions allows users to correct a mistake that could result in serious consequences. Providing the ability to review and correct information gives the user an opportunity to detect a mistake before taking an action that has serious consequences.


1 Answers

You must be overwriting "data" and forgetting to free the old content... have you checked this?

like image 104
Leandro Gomide Avatar answered Oct 06 '22 03:10

Leandro Gomide