OpenPGP: unlink blob from blob tree in pgp_free_blob()
Remove links pointing to the blob to be deleted from other blobs in the blob tree structure, so that removing a subordinate blob does not hurt its parent or siblings. Signed-off-by: Peter Marschall <peter@adpm.de>
This commit is contained in:
parent
da5a223e26
commit
4939432304
|
@ -527,6 +527,16 @@ static void
|
|||
pgp_free_blob(struct blob *blob)
|
||||
{
|
||||
if (blob) {
|
||||
if (blob->parent) {
|
||||
struct blob **p;
|
||||
|
||||
/* remove blob from list of parent's children */
|
||||
for (p = &blob->parent->files; *p != NULL && *p != blob; p = &(*p)->next)
|
||||
;
|
||||
if (*p == blob)
|
||||
*p = blob->next;
|
||||
}
|
||||
|
||||
if (blob->file)
|
||||
sc_file_free(blob->file);
|
||||
if (blob->data)
|
||||
|
|
Loading…
Reference in New Issue