[scilab-Users] problem with free function
Allan CORNET
allan.cornet at scilab.org
Mon Feb 14 08:23:49 CET 2011
Hi,
You can debug your code with Visual studio :
http://wiki.scilab.org/How_to_debug_an_external_source_code_linked_to_scilab
_with_Visual_Studio
Allan
De : Collewet Guylaine [mailto:guylaine.collewet at cemagref.fr]
Envoyé : vendredi 11 février 2011 17:22
À : users at lists.scilab.org
Objet : [scilab-Users] problem with free function
Hello,
I have a problem with the free function which makes scilab crash
I wrote two functions sci_imdilate and image_dilate
sci_imdilate is the interface between scilab and the function image_dilate
the memory pointed by l_dilated_image (see the code below) is allocated by
image_dilate and Id like to free it in sci_imdilate
however, a call to free makes scilab crash
If I remove the free, the whole function works properly
I cannot undersand why
Does someone see my mistake ?
I am working with scilab 5.2.2 32 bits on windows 7 (64 bits machine)
Regards
Guylaine Collewet
/////////////////////////
// function sci_imdilate
///////////////////////
double *l_dilated_image;
/
dilate_image(&l_image[0], m_image, n_image, &l_kernel[0], m_kernel,
n_kernel, &l_dilated_image, &l_mask[0], &ierr);
createMatrixOfDouble(pvApiCtx, 4, m_image, n_image, l_dilated_image);
if(l_dilated_image) {
free(l_dilated_image);
}
/////////////////////////
// function dilate_image
/////////////////////////
int dilate_image(double *image, int width, int height, double *kernel, int
kernel_width, int kernel_height, double **dilated_image, double *mask, int
*ierr)
{
/
if (!(*dilated_image = (double*)calloc(1,
sizeof(double)*width*height)))
{
*ierr=1;
return(-1);
}
/
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20110214/5273560e/attachment.htm>
More information about the users
mailing list