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:
Peter Marschall 2011-06-02 10:10:48 +02:00
parent da5a223e26
commit 4939432304
1 changed files with 10 additions and 0 deletions

View File

@ -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)