From 3226f7589f476b291e8baad2fcf3593db6f14cf9 Mon Sep 17 00:00:00 2001
From: Sebastian Kraft <mail@sebastiankraft.net>
Date: Sat, 22 Jul 2017 19:34:34 +0200
Subject: [PATCH] Add a virtual destructor to lfCallbackData to avoid memory
 leak in derived classes

---
 include/lensfun/lensfun.h.in | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/include/lensfun/lensfun.h.in b/include/lensfun/lensfun.h.in
index ee9cf41..ec87b3c 100644
--- a/include/lensfun/lensfun.h.in
+++ b/include/lensfun/lensfun.h.in
@@ -1909,18 +1909,22 @@ typedef void (*lfModifyColorFunc) (void *data, float x, float y,
 typedef void (*lfModifyCoordFunc) (void *data, float *iocoord, int count);
 
 // @cond
-    
+#ifdef __cplusplus
+
 /// Common ancestor for lfCoordCallbackData and lfColorCallbackData
 struct lfCallbackData
 {
     int priority;
     void *data;
     size_t data_size;
+
+    virtual ~lfCallbackData() {};
 };
 
 // A test point in the autoscale algorithm
 typedef struct { float angle, dist; } lfPoint;
 
+#endif
 // @endcond
 
 /**
-- 
2.13.3

