Bug 982373 - Don't leak val when we return early from nsComputedDOMStyle::DoGetTextDecoration(). r=dholbert
authorAndrew McCreight <continuation@gmail.com>
Thu, 13 Mar 2014 09:18:32 -0400
changeset 173375 ae03abb8673711010a37ad39b8a6a129ac976565
parent 173374 8b13d02000f4d049127de79e959b9add338df38b
child 173376 5b84220fd9623c9df309006fe638f3c76eeb6b1c
push id40985
push userryanvm@gmail.com
push dateThu, 13 Mar 2014 13:17:59 +0000
treeherdermozilla-inbound@5b84220fd962 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert
bugs982373
milestone30.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 982373 - Don't leak val when we return early from nsComputedDOMStyle::DoGetTextDecoration(). r=dholbert
layout/style/nsComputedDOMStyle.cpp
--- a/layout/style/nsComputedDOMStyle.cpp
+++ b/layout/style/nsComputedDOMStyle.cpp
@@ -3124,18 +3124,16 @@ nsComputedDOMStyle::DoGetTextCombineHori
   }
 
   return val;
 }
 
 CSSValue*
 nsComputedDOMStyle::DoGetTextDecoration()
 {
-  nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
-
   const nsStyleTextReset* textReset = StyleTextReset();
 
   // If decoration style or color wasn't initial value, the author knew the
   // text-decoration is a shorthand property in CSS 3.
   // Return nullptr in such cases.
   if (textReset->GetDecorationStyle() != NS_STYLE_TEXT_DECORATION_STYLE_SOLID) {
     return nullptr;
   }
@@ -3146,16 +3144,17 @@ nsComputedDOMStyle::DoGetTextDecoration(
   if (!isForegroundColor) {
     return nullptr;
   }
 
   // Otherwise, the web pages may have been written for CSS 2.1 or earlier,
   // i.e., text-decoration was assumed as a longhand property.  In that case,
   // we should return computed value same as CSS 2.1 for backward compatibility.
 
+  nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
   uint8_t line = textReset->mTextDecorationLine;
   // Clear the -moz-anchor-decoration bit and the OVERRIDE_ALL bits -- we
   // don't want these to appear in the computed style.
   line &= ~(NS_STYLE_TEXT_DECORATION_LINE_PREF_ANCHORS |
             NS_STYLE_TEXT_DECORATION_LINE_OVERRIDE_ALL);
 
   if (line == NS_STYLE_TEXT_DECORATION_LINE_NONE) {
     val->SetIdent(eCSSKeyword_none);