Skip to content

Commit

Permalink
Fix memory leaks issue which introduced by v4.3.11.
Browse files Browse the repository at this point in the history
  • Loading branch information
mobizt committed Jun 15, 2023
1 parent 6ad9471 commit 60d1e13
Show file tree
Hide file tree
Showing 36 changed files with 140 additions and 74 deletions.
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Firebase ESP8266 Client",
"version": "4.3.12",
"version": "4.3.13",
"keywords": "communication, REST, esp8266, arduino",
"description": "The secure, fast and reliable Firebase Realtime database library to read, store, update, delete, listen, backup, and restore data. You can also read and modify the database security rules with this library.",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name=Firebase ESP8266 Client

version=4.3.12
version=4.3.13

author=Mobizt

Expand Down
16 changes: 11 additions & 5 deletions src/FB_Const.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#include "Firebase_Client_Version.h"
#if !FIREBASE_CLIENT_VERSION_CHECK(40312)
#if !FIREBASE_CLIENT_VERSION_CHECK(40313)
#error "Mixed versions compilation."
#endif

/**
* Created June 9, 2023
* Created June 15, 2023
*
* This work is a part of Firebase ESP Client library
* Copyright (c) 2023 K. Suwatchai (Mobizt)
Expand Down Expand Up @@ -43,14 +43,20 @@
#include <functional>
#endif

#include "FB_Network.h"
#include "FirebaseFS.h"
#include "./mbfs/MB_FS.h"
#include "FB_Network.h"

#if defined(DEFAULT_FLASH_FS) || defined(DEFAULT_SD_FS)
#define FIREBASEJSON_USE_FS
#endif

#if defined(FIREBASE_USE_PSRAM)
#define FIREBASEJSON_USE_PSRAM
#endif
#include "json/FirebaseJson.h"

// FirebaseJson was already included in MB_FS.h
#include "./mbfs/MB_FS.h"

#include "MB_NTP.h"

#if defined(ENABLE_OTA_FIRMWARE_UPDATE) && (defined(ENABLE_RTDB) || defined(ENABLE_FB_STORAGE) || defined(ENABLE_GC_STORAGE))
Expand Down
2 changes: 1 addition & 1 deletion src/FB_Error.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "Firebase_Client_Version.h"
#if !FIREBASE_CLIENT_VERSION_CHECK(40312)
#if !FIREBASE_CLIENT_VERSION_CHECK(40313)
#error "Mixed versions compilation."
#endif

Expand Down
4 changes: 3 additions & 1 deletion src/FB_Network.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "Firebase_Client_Version.h"
#if !FIREBASE_CLIENT_VERSION_CHECK(40312)
#if !FIREBASE_CLIENT_VERSION_CHECK(40313)
#error "Mixed versions compilation."
#endif

Expand All @@ -23,7 +23,9 @@
#if defined(ESP32)
#include <WiFi.h>
#include <WiFiClient.h>
#if !defined(FB_ENABLE_EXTERNAL_CLIENT)
#include <ETH.h>
#endif
#include <WiFiClientSecure.h>
#if __has_include(<esp_idf_version.h>)
#include <esp_idf_version.h>
Expand Down
2 changes: 1 addition & 1 deletion src/FB_Utils.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "Firebase_Client_Version.h"
#if !FIREBASE_CLIENT_VERSION_CHECK(40312)
#if !FIREBASE_CLIENT_VERSION_CHECK(40313)
#error "Mixed versions compilation."
#endif

Expand Down
2 changes: 1 addition & 1 deletion src/Firebase.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "Firebase_Client_Version.h"
#if !FIREBASE_CLIENT_VERSION_CHECK(40312)
#if !FIREBASE_CLIENT_VERSION_CHECK(40313)
#error "Mixed versions compilation."
#endif

Expand Down
2 changes: 1 addition & 1 deletion src/Firebase.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "Firebase_Client_Version.h"
#if !FIREBASE_CLIENT_VERSION_CHECK(40312)
#if !FIREBASE_CLIENT_VERSION_CHECK(40313)
#error "Mixed versions compilation."
#endif

Expand Down
2 changes: 1 addition & 1 deletion src/FirebaseFS.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "Firebase_Client_Version.h"
#if !FIREBASE_CLIENT_VERSION_CHECK(40312)
#if !FIREBASE_CLIENT_VERSION_CHECK(40313)
#error "Mixed versions compilation."
#endif

Expand Down
4 changes: 2 additions & 2 deletions src/Firebase_Client_Version.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#ifndef FIREBASE_CLIENT_VERSION
#define FIREBASE_CLIENT_VERSION "4.3.12"
#define FIREBASE_CLIENT_VERSION_NUM 40312
#define FIREBASE_CLIENT_VERSION "4.3.13"
#define FIREBASE_CLIENT_VERSION_NUM 40313

/* The inconsistent file version checking to prevent mixed versions compilation. */
#define FIREBASE_CLIENT_VERSION_CHECK(ver) (ver == FIREBASE_CLIENT_VERSION_NUM)
Expand Down
4 changes: 2 additions & 2 deletions src/json/FirebaseJson.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/*
* FirebaseJson, version 3.0.6
* FirebaseJson, version 3.0.7
*
* The Easiest Arduino library to parse, create and edit JSON object using a relative path.
*
* Created March 5, 2023
* Created June 14, 2023
*
* Features
* - Using path to access node element in search style e.g. json.get(result,"a/b/c")
Expand Down
15 changes: 10 additions & 5 deletions src/json/FirebaseJson.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/*
* FirebaseJson, version 3.0.6
* FirebaseJson, version 3.0.7
*
* The Easiest Arduino library to parse, create and edit JSON object using a relative path.
*
* Created March 5, 2023
* Created June 14, 2023
*
* Features
* - Using path to access node element in search style e.g. json.get(result,"a/b/c")
Expand Down Expand Up @@ -49,7 +49,7 @@

#if defined(__arm__)
#ifndef MB_ARDUINO_ARM
#define MB_ARDUINO_ARM
#define MB_ARDUINO_ARM
#endif
#endif

Expand All @@ -73,7 +73,6 @@

#endif


#if defined(TEENSYDUINO)
#ifndef MB_ARDUINO_TEENSY
#define MB_ARDUINO_TEENSY
Expand All @@ -86,6 +85,9 @@
#undef min
#undef max
#endif


#if defined(FIREBASEJSON_USE_FS)
#if __has_include(<FS.h>)

#if defined(ESP8266)
Expand All @@ -104,6 +106,7 @@
#endif
#endif

#endif

#include <stdio.h>
#include "MB_List.h"
Expand Down Expand Up @@ -1359,8 +1362,10 @@ class FirebaseJsonBase
idle();
}

if (client->connected())
if (client->connected() || client->available())
{
chunkBufSize = client->available();

int availablePayload = chunkBufSize;

dataTime = millis();
Expand Down
9 changes: 7 additions & 2 deletions src/mbfs/MB_FS.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/**
* The MB_FS, filesystems wrapper class v1.0.15
* The MB_FS, filesystems wrapper class v1.0.16
*
* This wrapper class is for SD and Flash filesystems interface which supports SdFat (//https://github.com/greiman/SdFat)
*
* Created March 5, 2023
* Created June 14, 2023
*
* The MIT License (MIT)
* Copyright (c) 2023 K. Suwatchai (Mobizt)
Expand Down Expand Up @@ -35,11 +35,16 @@

#define FS_NO_GLOBALS
#if defined(ESP32) || defined(ESP8266) || defined(MB_ARDUINO_PICO)
#if defined(MBFS_FLASH_FS) || defined(MBFS_SD_FS)
#include <FS.h>
#endif
#endif
#include "MB_FS_Interfaces.h"
#include MB_STRING_INCLUDE_CLASS

#if defined(MBFS_FLASH_FS) || defined(MBFS_SD_FS)
#include "SPI.h"
#endif

#if defined(ESP32) && __has_include(<sys/stat.h>)
#ifdef _LITTLEFS_H_
Expand Down
4 changes: 2 additions & 2 deletions src/rtdb/FB_RTDB.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "Firebase_Client_Version.h"
#if !FIREBASE_CLIENT_VERSION_CHECK(40312)
#if !FIREBASE_CLIENT_VERSION_CHECK(40313)
#error "Mixed versions compilation."
#endif

Expand Down Expand Up @@ -1318,7 +1318,7 @@ uint8_t FB_RTDB::openErrorQueue(FirebaseData *fbdo, MB_StringPtr filename,
return count;
}

#if defined(ESP32) || defined(ESP8266) || defined(MB_ARDUINO_PICO)
#if (defined(MBFS_FLASH_FS) || defined(MBFS_SD_FS)) && (defined(ESP32) || defined(ESP8266) || defined(MB_ARDUINO_PICO))
uint8_t FB_RTDB::readQueueFile(FirebaseData *fbdo, fs::File &file, QueueItem &item, uint8_t mode)
{

Expand Down
4 changes: 2 additions & 2 deletions src/rtdb/FB_RTDB.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "Firebase_Client_Version.h"
#if !FIREBASE_CLIENT_VERSION_CHECK(40312)
#if !FIREBASE_CLIENT_VERSION_CHECK(40313)
#error "Mixed versions compilation."
#endif

Expand Down Expand Up @@ -2708,7 +2708,7 @@ class FB_RTDB
#endif

uint8_t openErrorQueue(FirebaseData *fbdo, MB_StringPtr filename, fb_esp_mem_storage_type storageType, uint8_t mode);
#if defined(ESP32) || defined(ESP8266) || defined(MB_ARDUINO_PICO)
#if (defined(MBFS_FLASH_FS) || defined(MBFS_SD_FS)) && (defined(ESP32) || defined(ESP8266) || defined(MB_ARDUINO_PICO))
uint8_t readQueueFile(FirebaseData *fbdo, fs::File &file, QueueItem &item, uint8_t mode);
#endif
#if defined(MBFS_ESP32_SDFAT_ENABLED)
Expand Down
2 changes: 1 addition & 1 deletion src/rtdb/QueryFilter.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "Firebase_Client_Version.h"
#if !FIREBASE_CLIENT_VERSION_CHECK(40312)
#if !FIREBASE_CLIENT_VERSION_CHECK(40313)
#error "Mixed versions compilation."
#endif

Expand Down
2 changes: 1 addition & 1 deletion src/rtdb/QueryFilter.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "Firebase_Client_Version.h"
#if !FIREBASE_CLIENT_VERSION_CHECK(40312)
#if !FIREBASE_CLIENT_VERSION_CHECK(40313)
#error "Mixed versions compilation."
#endif

Expand Down
2 changes: 1 addition & 1 deletion src/rtdb/QueueInfo.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "Firebase_Client_Version.h"
#if !FIREBASE_CLIENT_VERSION_CHECK(40312)
#if !FIREBASE_CLIENT_VERSION_CHECK(40313)
#error "Mixed versions compilation."
#endif

Expand Down
2 changes: 1 addition & 1 deletion src/rtdb/QueueInfo.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "Firebase_Client_Version.h"
#if !FIREBASE_CLIENT_VERSION_CHECK(40312)
#if !FIREBASE_CLIENT_VERSION_CHECK(40313)
#error "Mixed versions compilation."
#endif

Expand Down
2 changes: 1 addition & 1 deletion src/rtdb/QueueManager.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "Firebase_Client_Version.h"
#if !FIREBASE_CLIENT_VERSION_CHECK(40312)
#if !FIREBASE_CLIENT_VERSION_CHECK(40313)
#error "Mixed versions compilation."
#endif

Expand Down
2 changes: 1 addition & 1 deletion src/rtdb/QueueManager.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "Firebase_Client_Version.h"
#if !FIREBASE_CLIENT_VERSION_CHECK(40312)
#if !FIREBASE_CLIENT_VERSION_CHECK(40313)
#error "Mixed versions compilation."
#endif

Expand Down
2 changes: 1 addition & 1 deletion src/rtdb/stream/FB_MP_Stream.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "Firebase_Client_Version.h"
#if !FIREBASE_CLIENT_VERSION_CHECK(40312)
#if !FIREBASE_CLIENT_VERSION_CHECK(40313)
#error "Mixed versions compilation."
#endif

Expand Down
2 changes: 1 addition & 1 deletion src/rtdb/stream/FB_MP_Stream.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "Firebase_Client_Version.h"
#if !FIREBASE_CLIENT_VERSION_CHECK(40312)
#if !FIREBASE_CLIENT_VERSION_CHECK(40313)
#error "Mixed versions compilation."
#endif

Expand Down
2 changes: 1 addition & 1 deletion src/rtdb/stream/FB_Stream.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "Firebase_Client_Version.h"
#if !FIREBASE_CLIENT_VERSION_CHECK(40312)
#if !FIREBASE_CLIENT_VERSION_CHECK(40313)
#error "Mixed versions compilation."
#endif

Expand Down
2 changes: 1 addition & 1 deletion src/rtdb/stream/FB_Stream.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "Firebase_Client_Version.h"
#if !FIREBASE_CLIENT_VERSION_CHECK(40312)
#if !FIREBASE_CLIENT_VERSION_CHECK(40313)
#error "Mixed versions compilation."
#endif

Expand Down
2 changes: 1 addition & 1 deletion src/session/FB_Session.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "Firebase_Client_Version.h"
#if !FIREBASE_CLIENT_VERSION_CHECK(40312)
#if !FIREBASE_CLIENT_VERSION_CHECK(40313)
#error "Mixed versions compilation."
#endif

Expand Down
2 changes: 1 addition & 1 deletion src/session/FB_Session.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "Firebase_Client_Version.h"
#if !FIREBASE_CLIENT_VERSION_CHECK(40312)
#if !FIREBASE_CLIENT_VERSION_CHECK(40313)
#error "Mixed versions compilation."
#endif

Expand Down
Loading

0 comments on commit 60d1e13

Please sign in to comment.