@@ -178,6 +178,33 @@ void {{ cppClassName }}::{{ cppFunctionName }}Worker::Execute() {
178178 baton->result = result;
179179
180180 {%endif%}
181+
182+ {%each args|argsInfo as arg %}
183+ {%if not arg.isSelf %}
184+ {%if not arg.payloadFor %}
185+ {%if not arg.isCallbackFunction %}
186+ {%if not arg.isStructType %}
187+ {%if not arg.payloadFor %}
188+ {%if not arg.isStructType %}
189+ {%if not arg.isReturn %}
190+ {%if not arg.isPayload %}
191+ {%if arg.name %}
192+ {%if arg.cppClassName == ' String' %}
193+ free ((void *)baton->{{ arg.name }});
194+ {%endif%}
195+ {%if arg.cppClassName == ' Wrapper' %}
196+ free ((void *)baton->{{ arg.name }});
197+ {%endif%}
198+ {%endif%}
199+ {%endif%}
200+ {%endif%}
201+ {%endif%}
202+ {%endif%}
203+ {%endif%}
204+ {%endif%}
205+ {%endif%}
206+ {%endif%}
207+ {%endeach%}
181208}
182209
183210void {{ cppClassName }}::{{ cppFunctionName }}Worker::HandleErrorCallback() {
@@ -201,6 +228,17 @@ void {{ cppClassName }}::{{ cppFunctionName }}Worker::HandleErrorCallback() {
201228 {%each args|argsInfo as arg %}
202229 {%if arg.shouldAlloc %}
203230 {%if not arg.isCppClassStringOrArray %}
231+ {%if arg.cppClassName == " GitBuf" %}
232+ {%else %}
233+ {%if arg | isOid %}
234+ if (baton->{{ arg.name }}NeedsFree) {
235+ baton->{{ arg.name }}NeedsFree = false ;
236+ free ((void *)baton->{{ arg.name }});
237+ }
238+ {%else %}
239+ free ((void *)baton->{{ arg.name }});
240+ {%endif%}
241+ {%endif%}
204242 {%elsif arg | isOid %}
205243 if (baton->{{ arg.name }}NeedsFree) {
206244 baton->{{ arg.name }}NeedsFree = false ;
@@ -346,6 +384,13 @@ void {{ cppClassName }}::{{ cppFunctionName }}Worker::HandleOKCallback() {
346384 {%each args|argsInfo as arg %}
347385 {%if arg.shouldAlloc %}
348386 {%if not arg.isCppClassStringOrArray %}
387+ {%if arg.cppClassName == " GitBuf" %}
388+ {%else %}
389+ {%if arg | isOid %}
390+ {%else %}
391+ free ((void *)baton->{{ arg.name }});
392+ {%endif%}
393+ {%endif%}
349394 {%elsif arg | isOid %}
350395 if (baton->{{ arg.name }}NeedsFree) {
351396 baton->{{ arg.name }}NeedsFree = false ;
0 commit comments