Launching Product Timeline

Where To Put New Post On A Story

new post instagram story ideas artofit new post instagram story template ideas for new post story at jean begaye blog new post story background simple background design instagram frame premium psd instagram post mockup new post story instagram new post instagram story ideas instagram story ideas instagram story aesthetic new post story with music instagram story idea insta aesthetic new post story instagram story idea insta story gamingbible simplistic yet superb facebook discover 50 new post insta story ideas and instagram editing apps ideas songs to put on instagram story friends premium psd happy chinese new year instagram post story aesthetic new post story with music instagram story idea goulburn post story re identity goes nation wide peter long author modern instagram happy birthday story post background cbeditz trump lobs new threats at pro football team i may put a restriction premium psd instagram story and post mockup premium psd instagram story and post mockup brand new ibm appreciation post how to post an instagram story from pc laptop detailed guide new post story instagram ideas post instagram story template vector set of social media post story poster and banner sale merry pickleball put me in a coma a nervous system story sportsedtv selena gomez francia raísa confirm friendship in new post iheart finishing touches being put on new northern lights displays owen story ideas news at george amies blog instagram post ideas friends haberman trump put mar a lago staff in a dangerous situation 30 new post instagram stories templates why you should use them artofit best new post story template sandy zooming on instagram instagram love songs for ig story storytime ideas for instagram at agnes hendricks blog examples of a photo story story structure strengthen any story with elegant corporate instagram post story template social media hugedomains com instagram story ideas creative instagram stories sheffield could be first to see new post box of the future ukuran story instagram apa format yang ideal panduan 2026 premium vector content ideas for social media banner post for if you have new shoes that are a bit too tight in the toe and have no how to edit instagram story after posting instagram tips youtube how to post instagram story from laptop pc easy method youtube how to blur a photo in instagram story easiest method with filters aesthetic instagram story ideas aesthetic editing tutorials instagram story editing wedding story ideas new post story ideas new post instagram story making trending new post instagram story new post story ideas new post instagram story ideas insta story instagram new post story ideas instagram story ideas insta story how to create amazing new post story ideas for instagram 3 special how to blur photo in instagram story full guide youtube instagram story editing wedding story ideas new post story ideas new post story ideas newpost instagramstories instagram instapost instagram story editing wedding story ideas new post story ideas instagram story editing wedding story ideas new post story ideas new wineskins disruptions realignments matthew 9 17 with apostle d b liquidation auction are yaw ready for an auction let s do this d b liquidation auction are yaw ready for an auction let s do this car shopping q a tune in live to learn the strategies to get below instagram creative story ideas for new post story ideas youtube new post instagram story template Надписи Макеты фотографий Шаблоны d b liquidation auction are yaw ready for an auction let s do this

:
How To Write A Blog For Kids
Fix ownership and error handling bugs in refdb backend callbacks
pygit2_refdb_backend_write() wrapped libgit2's reference and signature pointers directly, so the Python objects freed memory that libgit2 frees again on return, a double free. Pass git_reference_dup() and git_signature_dup() copies instead. It also fed the _old OID pointer straight into git_oid_to_python(), crashing when libgit2 passes NULL for newly created references; map NULL to None, which RefdbBackend.write() already accepts. pygit2_refdb_backend_lookup() treated a None result as a type error, but None is how RefdbBackend.lookup() signals 'not found'; translate it to GIT_ENOTFOUND. Both lookup() and rename() leaked the Python Reference returned by the callback, because libgit2 takes ownership of the underlying git_reference while Reference_dealloc() would free it too. Detach the pointer from the Python object before releasing it. Add test_write_callback and test_write_callback_create, driving the write callback through libgit2's git_reference_set_target() and git_reference_create(). Follow-up to the fix for New Product Announcement Letter Sample Assisted-by: Kimi Code
1 parent How To Share Facebook Reels On Instagram Story commit cc48ea6

Premium psd instagram post mockup new post story instagram 2 files changed D b liquidation auction are yaw ready for an auction let s do this

Lines changed: 77 additions & 16 deletions

Instagram Story That You Posted Where To Put New Post On A

src/refdb_backend.c

Lines changed: 53 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -190,18 +190,30 @@ pygit2_refdb_backend_lookup(git_reference **out,
190190
result = (Reference *)PyObject_CallObject(be->lookup, args);
191191
Py_DECREF(args);
192192

193-
if ((err = git_error_for_exc()) != 0)
194-
goto out;
193+
if ((err = git_error_for_exc()) != 0) {
194+
Py_XDECREF(result);
195+
return err;
196+
}
197+
198+
// A lookup that finds nothing returns None, per RefdbBackend.lookup()
199+
if ((PyObject *)result == Py_None) {
200+
Py_DECREF(result);
201+
return GIT_ENOTFOUND;
202+
}
195203

196204
if (!PyObject_IsInstance((PyObject *)result, (PyObject *)&ReferenceType)) {
197205
PyErr_SetString(PyExc_TypeError, "Expected object of type pygit2.Reference");
198-
err = GIT_EUSER;
199-
goto out;
206+
Py_DECREF(result);
207+
return GIT_EUSER;
200208
}
201209

210+
// Ownership of the underlying git_reference is transferred to libgit2,
211+
// which sets its db field itself once the callback returns; detach it
212+
// from the Python object before releasing the object.
202213
*out = result->reference;
203-
out:
204-
return err;
214+
result->reference = NULL;
215+
Py_DECREF(result);
216+
return 0;
205217
}
206218

207219
static int
@@ -212,24 +224,46 @@ pygit2_refdb_backend_write(git_refdb_backend *_be,
212224
{
213225
struct pygit2_refdb_backend *be = (struct pygit2_refdb_backend *)_be;
214226

215-
PyObject *ref = wrap_reference((git_reference *)_ref, NULL); // XXX: Drops const
227+
// The Python objects take ownership of the reference and the signature,
228+
// so pass them copies; _ref and _who belong to the caller (libgit2).
229+
git_reference *reference;
230+
int err = git_reference_dup(&reference, (git_reference *)_ref); // XXX: Drops const
231+
if (err != 0) {
232+
return err;
233+
}
234+
235+
PyObject *ref = wrap_reference(reference, NULL);
216236
if (ref == NULL) {
237+
git_reference_free(reference);
217238
return GIT_EUSER;
218239
}
219240

220-
PyObject *who = build_signature(NULL, _who, "utf-8");
221-
if (who == NULL) {
241+
git_signature *signature;
242+
err = git_signature_dup(&signature, _who);
243+
if (err != 0) {
222244
Py_DECREF(ref);
223-
return GIT_EUSER;
245+
return err;
224246
}
225247

226-
PyObject *old = git_oid_to_python(_old);
227-
if (old == NULL) {
248+
PyObject *who = build_signature(NULL, signature, "utf-8");
249+
if (who == NULL) {
228250
Py_DECREF(ref);
229-
Py_DECREF(who);
230251
return GIT_EUSER;
231252
}
232253

254+
PyObject *old;
255+
if (_old == NULL) {
256+
old = Py_None;
257+
Py_INCREF(old);
258+
} else {
259+
old = git_oid_to_python(_old);
260+
if (old == NULL) {
261+
Py_DECREF(ref);
262+
Py_DECREF(who);
263+
return GIT_EUSER;
264+
}
265+
}
266+
233267
// Py_BuildValue takes ownership of ref, who and old (N format), even on failure, so
234268
// they must not be decref'd past this point.
235269
PyObject *args = Py_BuildValue("(NNNsNs)", ref, PyBool_FromLong(force), who, message,
@@ -239,7 +273,7 @@ pygit2_refdb_backend_write(git_refdb_backend *_be,
239273
}
240274

241275
PyObject_CallObject(be->write, args);
242-
int err = git_error_for_exc();
276+
err = git_error_for_exc();
243277
Py_DECREF(args);
244278
return err;
245279
}
@@ -277,6 +311,7 @@ pygit2_refdb_backend_rename(git_reference **out, git_refdb_backend *_be,
277311

278312
err = git_error_for_exc();
279313
if (err != 0) {
314+
Py_XDECREF(ref);
280315
return err;
281316
}
282317

@@ -287,9 +322,11 @@ pygit2_refdb_backend_rename(git_reference **out, git_refdb_backend *_be,
287322
}
288323

289324
// Ownership of the underlying git_reference is transferred to libgit2,
290-
// which sets its db field itself once the callback returns, so the Python
291-
// object must not be decref'd; same as in pygit2_refdb_backend_lookup.
325+
// which sets its db field itself once the callback returns; detach it
326+
// from the Python object before releasing the object.
292327
*out = ref->reference;
328+
ref->reference = NULL;
329+
Py_DECREF(ref);
293330
return 0;
294331
}
295332

test/test_refdb_backend.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,30 @@ def test_rename_callback(repo: Repository) -> None:
136136
assert repo.references['refs/heads/intl'].target == target
137137

138138

139+
def test_write_callback(repo: Repository) -> None:
140+
# Exercise the custom backend's write callback through libgit2's
141+
# git_reference_set_target; calling repo.backend.write() directly
142+
# bypasses it.
143+
refdb = pygit2.Refdb.new(repo)
144+
refdb.set_backend(repo.backend)
145+
repo.set_refdb(refdb)
146+
master = repo.references['refs/heads/master']
147+
i18n = repo.references['refs/heads/i18n']
148+
i18n.set_target(master.target)
149+
assert repo.references['refs/heads/i18n'].target == master.target
150+
151+
152+
def test_write_callback_create(repo: Repository) -> None:
153+
# Exercise the custom backend's write callback through libgit2's
154+
# git_reference_create, which passes old=NULL for new references.
155+
refdb = pygit2.Refdb.new(repo)
156+
refdb.set_backend(repo.backend)
157+
repo.set_refdb(refdb)
158+
master = repo.references['refs/heads/master']
159+
repo.references.create('refs/heads/test-write', master.target)
160+
assert repo.references['refs/heads/test-write'].target == master.target
161+
162+
139163
def test_delete(repo: Repository) -> None:
140164
old = repo.backend.lookup('refs/heads/i18n')
141165
repo.backend.delete('refs/heads/i18n', old.target, None)

Mobile Banking Bank Of America Platum Debt Card Where To Put New Post On A Story

Comments
 (0)