diff --git a/content/svg/content/src/nsSVGPathElement.cpp b/content/svg/content/src/nsSVGPathElement.cpp index 9ae8cdb24296..06ee1f2a2909 100644 --- a/content/svg/content/src/nsSVGPathElement.cpp +++ b/content/svg/content/src/nsSVGPathElement.cpp @@ -151,9 +151,9 @@ nsSVGPathElement::GetPathSegAtLength(float distance, PRUint32 *_retval) // because if distance is longer than the total length of the path we return // the index of the final segment anyway. while (distCovered < distance && i < numSegments - 1) { - nsIDOMSVGPathSeg *iSeg; - mSegments->GetItem(i, &iSeg); - nsSVGPathSeg* curSeg = static_cast(iSeg); + nsCOMPtr segment; + mSegments->GetItem(i, getter_AddRefs(segment)); + nsSVGPathSeg* curSeg = static_cast(segment.get()); if (i == 0) { curSeg->GetLength(&ts); } else {