@@ -271,9 +271,6 @@ LLDBSwigPythonCreateScriptedThreadPlan
271
271
if (python_class_name == NULL || python_class_name[0] == '\0' || !session_dictionary_name)
272
272
Py_RETURN_NONE;
273
273
274
- // I do not want the SBThreadPlan to be deallocated when going out of scope because python
275
- // has ownership of it and will manage memory for this object by itself
276
- lldb::SBThreadPlan *tp_value = new lldb::SBThreadPlan(thread_plan_sp);
277
274
278
275
PyErr_Cleaner py_err_cleaner(true);
279
276
@@ -286,7 +283,10 @@ LLDBSwigPythonCreateScriptedThreadPlan
286
283
return nullptr;
287
284
}
288
285
289
- PythonObject tp_arg(PyRefType::Owned, SBTypeToSWIGWrapper(tp_value));
286
+ // I do not want the SBThreadPlan to be deallocated when going out of scope
287
+ // because python has ownership of it and will manage memory for this
288
+ // object by itself
289
+ PythonObject tp_arg(PyRefType::Owned, SBTypeToSWIGWrapper(new lldb::SBThreadPlan(thread_plan_sp)));
290
290
291
291
if (!tp_arg.IsAllocated())
292
292
Py_RETURN_NONE;
@@ -312,8 +312,7 @@ LLDBSwigPythonCreateScriptedThreadPlan
312
312
}
313
313
result = pfunc(tp_arg, dict);
314
314
} else if (arg_info.get().max_positional_args >= 3) {
315
- lldb::SBStructuredData *args_value = new lldb::SBStructuredData(args_impl);
316
- PythonObject args_arg(PyRefType::Owned, SBTypeToSWIGWrapper(args_value));
315
+ PythonObject args_arg(PyRefType::Owned, SBTypeToSWIGWrapper(new lldb::SBStructuredData(args_impl)));
317
316
result = pfunc(tp_arg, args_arg, dict);
318
317
} else {
319
318
error_string.assign("wrong number of arguments in __init__, should be 2 or 3 (not including self)");
0 commit comments