IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 3, 2007, 1:25:52 PM (19 years ago)
Author:
jhoblitt
Message:

pxTreeFromMetadata - fix reference counting problem

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippTools/src/pxtree.c

    r15187 r15190  
    6565    // if the child already has a parent, release the ref count
    6666    if (child->parent) {
    67         psMemDecrRefCounter(child->parent);
     67        psFree(child->parent);
    6868    }
    6969    // [re]parent the child
     
    167167            // add it to the hash of nodes
    168168            psHashAdd(nodeNames, item->name, node);
     169            // node may be used below because it will still have a ref count of
     170            // 1 from being on the hash, this is equivalent to the "view" we
     171            // get from a hashlookup
     172            psFree(node);
    169173        }
    170174
     
    178182                // add it to the hash of nodes
    179183                psHashAdd(nodeNames, item->data.str, child);
     184                // child may be used below because it will still have a ref
     185                // count of 1 from being on the hash, this is equivalent to the
     186                // "view" we get from a hashlookup
     187                psFree(child);
    180188            }
    181189            pxNodeAddChild(node, child);
    182190        }
    183 
    184         psFree(node);
    185191    }
    186192    psFree(iter);
     
    189195    psFree(nodeNames);
    190196
    191     return root;
     197    return psMemIncrRefCounter(root);
    192198}
Note: See TracChangeset for help on using the changeset viewer.