diff --git a/io/channel-buffer.c b/io/channel-buffer.c index 60cd33587b..bd3256df92 100644 --- a/io/channel-buffer.c +++ b/io/channel-buffer.c @@ -35,12 +35,12 @@ qio_channel_buffer_new(size_t capacity) if (capacity) { ioc->data = g_new0(uint8_t, capacity); ioc->capacity = capacity; - - //// --- Begin LibAFL code --- - ioc->internal_allocation = true; - //// --- End LibAFL code --- } + //// --- Begin LibAFL code --- + ioc->internal_allocation = capacity > 0; + //// --- End LibAFL code --- + return ioc; } @@ -75,6 +75,7 @@ static void qio_channel_buffer_finalize(Object *obj) g_free(ioc->data); } + ioc->data = NULL; //// --- End LibAFL code --- // g_free(ioc->data); @@ -181,8 +182,8 @@ static int qio_channel_buffer_close(QIOChannel *ioc, g_free(bioc->data); } - //g_free(bioc->data); //// --- End LibAFL code --- + //g_free(bioc->data); bioc->data = NULL; bioc->capacity = bioc->usage = bioc->offset = 0; diff --git a/libafl/syx-snapshot/device-save.c b/libafl/syx-snapshot/device-save.c index 38e6e1bac6..2df2442761 100644 --- a/libafl/syx-snapshot/device-save.c +++ b/libafl/syx-snapshot/device-save.c @@ -99,6 +99,7 @@ void device_restore_all(DeviceSaveState* dss) { libafl_restoring_devices = save_libafl_restoring_devices; + object_unref(OBJECT(bioc)); qemu_fclose(f); }