[Tizen] Fix Coverity issues 80/209780/1
authorSeoyeon Kim <seoyeon2.kim@samsung.com>
Thu, 11 Jul 2019 01:33:14 +0000 (10:33 +0900)
committerSeoyeon Kim <seoyeon2.kim@samsung.com>
Thu, 11 Jul 2019 01:55:06 +0000 (10:55 +0900)
- Null pointer dereferences
- In AutofillManagerEcoreWl, some dereference ponters are compared before null check.

Change-Id: Id6e64478d933ba988e87e1cd5a6d0483b5ff3a5d
Signed-off-by: Seoyeon Kim <seoyeon2.kim@samsung.com>
dali/internal/input/tizen-wayland/autofill-manager-impl-ecore-wl.cpp

index 2483ae1..a00e3e2 100755 (executable)
@@ -336,27 +336,26 @@ void AutofillManagerEcoreWl::ReceiveAuthInfo( autofill_auth_info_h authInfoHandl
                                                 serviceName, serviceLogoImagePath, serviceMessage );
 
     // Sets the authentication service information in order to use in other components.
-    mAuthenticationServiceName = serviceName;
-    mAuthenticationServiceMessage = serviceMessage;
-    mAuthenticationServiceImagePath = serviceLogoImagePath;
-
-    // Emits the signal to receive the authentication information.
-    mAuthReceivedSignal.Emit();
-
-    if( serviceMessage )
+    if( serviceName )
     {
-      free( serviceMessage );
+      mAuthenticationServiceName = serviceName;
+      free( serviceName );
     }
 
-    if( serviceName )
+    if( serviceMessage )
     {
-      free( serviceName );
+      mAuthenticationServiceMessage = serviceMessage;
+      free( serviceMessage );
     }
 
     if( serviceLogoImagePath )
     {
+      mAuthenticationServiceImagePath = serviceLogoImagePath;
       free( serviceLogoImagePath );
     }
+
+    // Emits the signal to receive the authentication information.
+    mAuthReceivedSignal.Emit();
   }
   else
   {
@@ -381,33 +380,32 @@ void AutofillManagerEcoreWl::FillGroupItem( autofill_fill_response_item_h itemHa
                                               id, value, presentationText );
 
   // Sets the fill response information in order to use in other components.
-  mFillItemId = id;
-  mFillItemPresentationText = presentationText;
-  mFillItemValue = value;
-
-  Dali::AutofillItem item = mAutofillGroup.GetAutofillItem( id );
-  Internal::Adaptor::AutofillItem& itemImpl = Internal::Adaptor::GetImplementation( item );
-  itemImpl.AddPresentationList( presentationText );
-  itemImpl.AddFillValueList( value );
-
-  // Emits the signal to fill the data in text input field.
-  mFillReceivedSignal.Emit( item );
-
   if( id )
   {
+    mFillItemId = id;
     free( id );
   }
 
-  if( value )
+  if( presentationText )
   {
-    free( value );
+    mFillItemPresentationText = presentationText;
+    free( presentationText );
   }
 
-  if( presentationText )
+  if( value )
   {
-    free( presentationText );
+    mFillItemValue = value;
+    free( value );
   }
 
+  Dali::AutofillItem item = mAutofillGroup.GetAutofillItem( mFillItemId );
+  Internal::Adaptor::AutofillItem& itemImpl = Internal::Adaptor::GetImplementation( item );
+  itemImpl.AddPresentationList( mFillItemPresentationText );
+  itemImpl.AddFillValueList( mFillItemValue );
+
+  // Emits the signal to fill the data in text input field.
+  mFillReceivedSignal.Emit( item );
+
 }
 
 // Implementation to fill out the data when the group count is more than one.
@@ -426,29 +424,29 @@ void AutofillManagerEcoreWl::FillMultipleGroupItem( autofill_fill_response_item_
                                               id, value, presentationText );
 
   // Sets the fill response information in order to use in other components.
-  mFillItemId = id;
-  mFillItemPresentationText = presentationText;
-  mFillItemValue = value;
-
-  Dali::AutofillItem item = mAutofillGroup.GetAutofillItem( id );
-  Internal::Adaptor::AutofillItem& itemImpl = Internal::Adaptor::GetImplementation( item );
-  itemImpl.AddPresentationList( presentationText );
-  itemImpl.AddFillValueList( value );
-
   if( id )
   {
+    mFillItemId = id;
     free( id );
   }
 
-  if( value )
+  if( presentationText )
   {
-    free( value );
+    mFillItemPresentationText = presentationText;
+    free( presentationText );
   }
 
-  if( presentationText )
+  if( value )
   {
-    free( presentationText );
+    mFillItemValue = value;
+    free( value );
   }
+
+  Dali::AutofillItem item = mAutofillGroup.GetAutofillItem( mFillItemId );
+  Internal::Adaptor::AutofillItem& itemImpl = Internal::Adaptor::GetImplementation( item );
+  itemImpl.AddPresentationList( mFillItemPresentationText );
+  itemImpl.AddFillValueList( mFillItemValue );
+
 }
 #endif // CAPI_AUTOFILL_SUPPORT