better error control in fimg_destroy
This commit is contained in:
parent
43b625b5ef
commit
83f80ad496
@ -106,7 +106,6 @@ return 0;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
int fimg_destroy(FloatImg *fimg)
|
||||
{
|
||||
|
||||
@ -114,10 +113,18 @@ int fimg_destroy(FloatImg *fimg)
|
||||
fprintf(stderr, ">>> %-25s ( %p )\n", __func__, fimg);
|
||||
#endif
|
||||
|
||||
if (NULL == fimg) {
|
||||
fprintf(stderr, "%s : parameter is null\n", __func__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ( ! fimg_type_is_valid(fimg->type) ) {
|
||||
return -2;
|
||||
}
|
||||
|
||||
if (NULL == fimg->R) {
|
||||
fprintf(stderr, "%s : %p already freeed\n", __func__, fimg);
|
||||
return -3;
|
||||
}
|
||||
free(fimg->R);
|
||||
memset(fimg, 0, sizeof(FloatImg));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user