Fix the svace issue - DEREF_AFTER_NULL
[platform/core/connectivity/bluetooth-frwk.git] / bt-api / bt-rfcomm-client.c
index a642e10..315aa4b 100644 (file)
@@ -1446,7 +1446,7 @@ BT_EXPORT_API int bluetooth_rfcomm_write(int fd, const char *buf, int length)
                         BT_INFO("Adding rfcomm tx timeout function for battery monitor");
                         tx_tag = g_timeout_add_seconds(BATTERY_MONITOR_RFCOMM_INTERVAL, (GSourceFunc)__rfcomm_record_tx_data, NULL);
                 }
-                tx_data += length;
+                tx_data += written;
         }
        return written;
 #else
@@ -1456,7 +1456,7 @@ BT_EXPORT_API int bluetooth_rfcomm_write(int fd, const char *buf, int length)
                         BT_INFO("Adding rfcomm tx timeout function for battery monitor");
                         tx_tag = g_timeout_add_seconds(BATTERY_MONITOR_RFCOMM_INTERVAL, (GSourceFunc)__rfcomm_record_tx_data, NULL);
                 }
-                tx_data += length;
+                tx_data += written;
         }
        return result;
 #endif