Bug 397017 - leak of some svg base types when unsetting. r+sr+a=roc
authortor@cs.brown.edu
Tue, 02 Oct 2007 07:52:56 -0700
changeset 6538 20485b6fa8c8e8055a89ff5e933905e8aae90c78
parent 6537 63e8f57c7f45cc4e234f06882e9c463982312081
child 6539 ecda7404a6034784ebc3a98dd8be88cd4dd61bfb
push idunknown
push userunknown
push dateunknown
bugs397017
milestone1.9a9pre
Bug 397017 - leak of some svg base types when unsetting. r+sr+a=roc
content/svg/content/src/nsSVGElement.cpp
--- a/content/svg/content/src/nsSVGElement.cpp
+++ b/content/svg/content/src/nsSVGElement.cpp
@@ -392,51 +392,51 @@ nsSVGElement::UnsetAttr(PRInt32 aNamespa
       if (svg_value) {
 #ifdef DEBUG_tor
         nsCOMPtr<nsIDOMSVGAnimatedAngle> a = do_QueryInterface(svg_value);
         NS_ASSERTION(!a, "must provide element processing for unset angle");
 #endif
 
         nsCOMPtr<nsIDOMSVGAnimatedRect> r = do_QueryInterface(svg_value);
         if (r) {
-          nsIDOMSVGRect *rect;
-          r->GetBaseVal(&rect);
-          static_cast<nsSVGRect*>(rect)->Clear();
+          nsCOMPtr<nsIDOMSVGRect> rect;
+          r->GetBaseVal(getter_AddRefs(rect));
+          static_cast<nsSVGRect*>(rect.get())->Clear();
         }
         nsCOMPtr<nsIDOMSVGAnimatedPreserveAspectRatio> ar = do_QueryInterface(svg_value);
         if (ar) {
-          nsIDOMSVGPreserveAspectRatio *par;
-          ar->GetBaseVal(&par);
+          nsCOMPtr<nsIDOMSVGPreserveAspectRatio> par;
+          ar->GetBaseVal(getter_AddRefs(par));
           par->SetAlign(nsIDOMSVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMIDYMID);
           par->SetMeetOrSlice(nsIDOMSVGPreserveAspectRatio::SVG_MEETORSLICE_MEET);
         }
         nsCOMPtr<nsIDOMSVGAnimatedString> s = do_QueryInterface(svg_value);
         if (s) {
           s->Clear();
         }
         nsCOMPtr<nsIDOMSVGPointList> pl = do_QueryInterface(svg_value);
         if (pl) {
           pl->Clear();
         }
         nsCOMPtr<nsIDOMSVGAnimatedLengthList> ll = do_QueryInterface(svg_value);
         if (ll) {
-          nsIDOMSVGLengthList *lengthlist;
-          ll->GetBaseVal(&lengthlist);
+          nsCOMPtr<nsIDOMSVGLengthList> lengthlist;
+          ll->GetBaseVal(getter_AddRefs(lengthlist));
           lengthlist->Clear();
         }
         nsCOMPtr<nsIDOMSVGAnimatedNumberList> nl = do_QueryInterface(svg_value);
         if (nl) {
-          nsIDOMSVGNumberList *numberlist;
-          nl->GetBaseVal(&numberlist);
+          nsCOMPtr<nsIDOMSVGNumberList> numberlist;
+          nl->GetBaseVal(getter_AddRefs(numberlist));
           numberlist->Clear();
         }
         nsCOMPtr<nsIDOMSVGAnimatedTransformList> tl = do_QueryInterface(svg_value);
         if (tl) {
-          nsIDOMSVGTransformList *transform;
-          tl->GetBaseVal(&transform);
+          nsCOMPtr<nsIDOMSVGTransformList> transform;
+          tl->GetBaseVal(getter_AddRefs(transform));
           transform->Clear();
         }
       }
     }
   }
 
   return nsSVGElementBase::UnsetAttr(aNamespaceID, aName, aNotify);
 }