Regarding segmantation violation
Tito
farmatito at tiscali.it
Fri Jun 1 12:35:23 UTC 2007
On Friday 01 June 2007 13:21:09 Sekhar Pedamallu wrote:
for(l_iIndex = 0; l_iIndex < l_iCount ; l_iIndex++)
{
l_pcTemp = (char *)malloc(l_iSize);
if(NULL == l_pcTemp)
{
printf("Memory allocation failed \n");
exit(1);
}
// printf(" Start Address %p \n",l_pcTemp);
// printf(" End Address %p \n",l_pcTemp+l_iSize-1);
====> memset(l_pcTemp,0,l_iSize); maybe memset(l_pcTemp,0,strlen(l_pcTemp)); will work better???
free(l_pcTemp);
}
BTW: you can use calloc() instead of malloc() + memset()
Ciao,
Tito
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.busybox.net/pipermail/busybox/attachments/20070601/031e890d/attachment-0002.htm
More information about the busybox
mailing list