Commit 97ebef4a authored by Greg Williams's avatar Greg Williams
Browse files

Fixed deallocation issue with kinetic operations

parent 779ba2b9
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -10,8 +10,8 @@ PUB_INC = ./include
#===============================================================================
CC ?= gcc
OPTIMIZE = -O3
WARN = -Wall -Wextra -Wstrict-prototypes -Wcast-align -pedantic
CDEFS += -D_POSIX_C_SOURCE=1 -D_C99_SOURCE=1
WARN = -Wall -Wextra -Wstrict-prototypes -Wcast-align -pedantic -Wno-missing-field-initializers
CDEFS += -D_POSIX_C_SOURCE=199309L -D_C99_SOURCE=1
CFLAGS += -std=c99 -fPIC -g $(WARN) $(CDEFS) $(OPTIMIZE)
LDFLAGS += -lm -l crypto -l ssl -l pthread

+2 −2
Original line number Diff line number Diff line
@@ -95,7 +95,7 @@
      # - -Wincompatible-pointer-types
      # - -Werror=incompatible-pointer-types
      # - -Wcast-align
      - -D_POSIX_C_SOURCE=1
      - -D_POSIX_C_SOURCE=199309L
      - -D_C99_SOURCE=1
      - ${1}
  :test_compiler:
@@ -116,7 +116,7 @@
      # - -Werror=incompatible-pointer-types
      # - -Wincompatible-pointer-types
      # - -Wcast-align
      - -D_POSIX_C_SOURCE=1
      - -D_POSIX_C_SOURCE=199309L
      - -D_C99_SOURCE=1
      - -Wno-nonnull
      - -Wno-address
+18 −2
Original line number Diff line number Diff line
@@ -344,8 +344,24 @@ void KineticAllocator_FreeAllOperations(KineticConnection* const connection)
        LOGF3("Freeing operations list (0x%0llX) from connection (0x%0llX)...",
            &connection->operations, connection);
        while (current != NULL) {
            KineticAllocator_FreeOperation(connection, current->data);
            KineticOperation* op = (KineticOperation*)current->data;
            if (op != NULL) {

                if (op->request != NULL) {
                    LOGF3("Freeing request PDU (0x%0llX) from operation (0x%0llX) on connection (0x%0llX)",
                        op->request, op, connection);
                    KineticAllocator_FreePDU(connection, op->request);
                }

                if (op->response != NULL) {
                    LOGF3("Freeing response PDU (0x%0llX) from op (0x%0llX) on connection (0x%0llX)",
                        op->response, op, connection);
                    KineticAllocator_FreePDU(connection, op->response);
                }

                current = current->next;
                KineticAllocator_FreeItem(&connection->operations, (void*)op);
            }
        }
    }
    else {
+6 −2
Original line number Diff line number Diff line
@@ -95,8 +95,12 @@ struct _KineticConnection {
    bool            threadCreated;  // thread creation status
};
#define KINETIC_CONNECTION_INIT(_con) { (*_con) = (KineticConnection) { \
    .connected = false, .socket = -1, \
    .operations = KINETIC_LIST_INITIALIZER, .pdus = KINETIC_LIST_INITIALIZER}; }
        .connected = false, \
        .socket = -1, \
        .operations = KINETIC_LIST_INITIALIZER, \
        .pdus = KINETIC_LIST_INITIALIZER, \
    }; \
}


// Kinetic Message HMAC
+6 −0
Original line number Diff line number Diff line
@@ -41,6 +41,12 @@
#include <string.h>
#include <stdlib.h>

#if _POSIX_C_SOURCE < 199309L
#error Your version of Posix C ## _POSIX_C_SOURCE ## is too old!
#endif

#include <time.h>

static SystemTestFixture Fixture;
static KineticEntry Entry;
static uint8_t KeyData[1024];
Loading