diff --git a/lib/fimg-core.c b/lib/fimg-core.c index 0e24dcec..325ff63d 100644 --- a/lib/fimg-core.c +++ b/lib/fimg-core.c @@ -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));