diff options
Diffstat (limited to 'intern/opencolorio')
-rw-r--r-- | intern/opencolorio/ocio_capi.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/intern/opencolorio/ocio_capi.cpp b/intern/opencolorio/ocio_capi.cpp index d67cea61836..2fa66e5d2f5 100644 --- a/intern/opencolorio/ocio_capi.cpp +++ b/intern/opencolorio/ocio_capi.cpp @@ -47,13 +47,13 @@ #endif #define MEM_NEW(type) new(MEM_mallocN(sizeof(type), __func__)) type() -#define MEM_DELETE(what, type) { what->~type(); MEM_freeN(what); } (void)0 +#define MEM_DELETE(what, type) if(what) { what->~type(); MEM_freeN(what); } (void)0 static void OCIO_reportError(const char *err) { std::cerr << "OpenColorIO Error: " << err << std::endl; - OCIO_abort(); + // OCIO_abort(); } static void OCIO_reportException(Exception &exception) @@ -75,6 +75,8 @@ ConstConfigRcPtr *OCIO_getCurrentConfig(void) OCIO_reportException(exception); } + MEM_DELETE(config, ConstConfigRcPtr); + return NULL; } @@ -107,6 +109,8 @@ ConstConfigRcPtr *OCIO_configCreateFromEnv(void) OCIO_reportException(exception); } + MEM_DELETE(config, ConstConfigRcPtr); + return NULL; } @@ -125,6 +129,8 @@ ConstConfigRcPtr *OCIO_configCreateFromFile(const char *filename) OCIO_reportException(exception); } + MEM_DELETE(config, ConstConfigRcPtr); + return NULL; } @@ -169,9 +175,10 @@ ConstColorSpaceRcPtr *OCIO_configGetColorSpace(ConstConfigRcPtr *config, const c } catch (Exception &exception) { OCIO_reportException(exception); - MEM_DELETE(cs, ConstColorSpaceRcPtr); } + MEM_DELETE(cs, ConstColorSpaceRcPtr); + return NULL; } @@ -314,6 +321,8 @@ ConstProcessorRcPtr *OCIO_configGetProcessorWithNames(ConstConfigRcPtr *config, OCIO_reportException(exception); } + MEM_DELETE(p, ConstProcessorRcPtr); + return 0; } @@ -331,6 +340,8 @@ ConstProcessorRcPtr *OCIO_configGetProcessor(ConstConfigRcPtr *config, ConstTran OCIO_reportException(exception); } + MEM_DELETE(p, ConstProcessorRcPtr); + return NULL; } |