From 7e7864db7da43b2b7bce61b39ed1a1673fb7cc14 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 4 Jan 2024 10:15:26 +1000 Subject: [PATCH 1/7] test: fix various leaks in the tests (cherry picked from commit 2cee5fb36cdf98488422d6c85f0076e3a70a3ca4) --- dix/devices.c | 2 +- include/input.h | 2 ++ test/input.c | 17 +++++++++++++++++ test/list.c | 4 ++++ test/signal-logging.c | 5 ++++- test/test_xkb.c | 8 ++++++++ test/xfree86.c | 7 +++++++ 7 files changed, 43 insertions(+), 2 deletions(-) diff --git a/dix/devices.c b/dix/devices.c index 5f6d32e53..28056a0a8 100644 --- a/dix/devices.c +++ b/dix/devices.c @@ -790,7 +790,7 @@ InitAndStartDevices(void) /** * Free the given device class and reset the pointer to NULL. */ -static void +void FreeDeviceClass(int type, void **class) { if (!(*class)) diff --git a/include/input.h b/include/input.h index cdb5d5a90..805341641 100644 --- a/include/input.h +++ b/include/input.h @@ -325,6 +325,8 @@ extern _X_EXPORT Bool InitButtonClassDeviceStruct(DeviceIntPtr /*device */ , extern _X_INTERNAL ValuatorClassPtr AllocValuatorClass(ValuatorClassPtr src, int numAxes); +extern _X_INTERNAL void FreeDeviceClass(int type, void **class); + extern _X_EXPORT Bool InitValuatorClassDeviceStruct(DeviceIntPtr /*device */ , int /*numAxes */ , diff --git a/test/input.c b/test/input.c index e27374db3..34a75fd7f 100644 --- a/test/input.c +++ b/test/input.c @@ -154,6 +154,9 @@ dix_init_valuators(void) assert(axis->scroll.type == SCROLL_TYPE_VERTICAL); assert(axis->scroll.increment == 3.0); assert(axis->scroll.flags == SCROLL_FLAG_NONE); + + FreeDeviceClass(ValuatorClass, (void**)&val); + free(dev.last.scroll); /* sigh, allocated but not freed by the valuator functions */ } /* just check the known success cases, and that error cases set the client's @@ -282,6 +285,7 @@ dix_event_to_core(int type) ev.detail.key = 0; rc = EventToCore((InternalEvent *) &ev, &core, &count); test_event(); + free(core); x = 1; y = 2; @@ -289,6 +293,7 @@ dix_event_to_core(int type) ev.root_y = y; rc = EventToCore((InternalEvent *) &ev, &core, &count); test_event(); + free(core); x = 0x7FFF; y = 0x7FFF; @@ -296,6 +301,7 @@ dix_event_to_core(int type) ev.root_y = y; rc = EventToCore((InternalEvent *) &ev, &core, &count); test_event(); + free(core); x = 0x8000; /* too high */ y = 0x8000; /* too high */ @@ -307,6 +313,7 @@ dix_event_to_core(int type) assert(count == 1); assert(core->u.keyButtonPointer.rootX != x); assert(core->u.keyButtonPointer.rootY != y); + free(core); x = 0x7FFF; y = 0x7FFF; @@ -316,16 +323,19 @@ dix_event_to_core(int type) ev.time = time; rc = EventToCore((InternalEvent *) &ev, &core, &count); test_event(); + free(core); detail = 1; ev.detail.key = detail; rc = EventToCore((InternalEvent *) &ev, &core, &count); test_event(); + free(core); detail = 0xFF; /* highest value */ ev.detail.key = detail; rc = EventToCore((InternalEvent *) &ev, &core, &count); test_event(); + free(core); detail = 0xFFF; /* too big */ ev.detail.key = detail; @@ -338,6 +348,7 @@ dix_event_to_core(int type) ev.corestate = state; rc = EventToCore((InternalEvent *) &ev, &core, &count); test_event(); + free(core); state = 0x10000; /* too big */ ev.corestate = state; @@ -347,6 +358,7 @@ dix_event_to_core(int type) assert(count == 1); assert(core->u.keyButtonPointer.state != state); assert(core->u.keyButtonPointer.state == (state & 0xFFFF)); + free(core); #undef test_event } @@ -1197,6 +1209,7 @@ dix_input_attributes(void) new = DuplicateInputAttributes(orig); assert(memcmp(orig, new, sizeof(InputAttributes)) == 0); + FreeInputAttributes(new); orig->product = xnfstrdup("product name"); new = DuplicateInputAttributes(orig); @@ -1330,6 +1343,7 @@ dix_input_valuator_masks(void) } valuator_mask_free(&mask); + valuator_mask_free(©); assert(mask == NULL); } @@ -1361,6 +1375,9 @@ dix_valuator_mode(void) valuator_set_mode(&dev, VALUATOR_MODE_ALL_AXES, Relative); for (i = 0; i < num_axes; i++) assert(valuator_get_mode(&dev, i) == Relative); + + FreeDeviceClass(ValuatorClass, (void**)&dev.valuator); + free(dev.last.scroll); /* sigh, allocated but not freed by the valuator functions */ } static void diff --git a/test/list.c b/test/list.c index d51817c21..fee41a538 100644 --- a/test/list.c +++ b/test/list.c @@ -266,6 +266,8 @@ test_nt_list_append(void) i++; } assert(i == 11); + + free(foo); } static void @@ -300,6 +302,8 @@ test_nt_list_insert(void) i++; } assert(i == 11); + + free(foo); } static void diff --git a/test/signal-logging.c b/test/signal-logging.c index 4ba8485fc..97477dcee 100644 --- a/test/signal-logging.c +++ b/test/signal-logging.c @@ -176,13 +176,16 @@ static void logging_format(void) char read_buf[2048]; char *logmsg; uintptr_t ptr; + char *fname = NULL; /* set up buf to contain ".....end" */ memset(buf, '.', sizeof(buf)); strcpy(&buf[sizeof(buf) - 4], "end"); - LogInit(log_file_path, NULL); + fname = (char*)LogInit(log_file_path, NULL); + assert(fname != NULL); assert((f = fopen(log_file_path, "r"))); + free(fname); #define read_log_msg(msg) do { \ msg = fgets(read_buf, sizeof(read_buf), f); \ diff --git a/test/test_xkb.c b/test/test_xkb.c index f81a7ed65..cb02cd91a 100644 --- a/test/test_xkb.c +++ b/test/test_xkb.c @@ -76,6 +76,8 @@ xkb_get_rules_test(void) assert(strcmp(rmlvo.layout, XKB_DFLT_LAYOUT) == 0); assert(strcmp(rmlvo.variant, XKB_DFLT_VARIANT) == 0); assert(strcmp(rmlvo.options, XKB_DFLT_OPTIONS) == 0); + + XkbFreeRMLVOSet(&rmlvo, FALSE); } /** @@ -115,6 +117,7 @@ xkb_set_rules_test(void) assert(strcmp(rmlvo.options, rmlvo_new.options) == 0); XkbFreeRMLVOSet(&rmlvo, FALSE); + XkbFreeRMLVOSet(&rmlvo_new, FALSE); } /** @@ -140,6 +143,7 @@ xkb_set_get_rules_test(void) /* pass 1 */ XkbSetRulesDflts(&rmlvo); + XkbFreeRMLVOSet(&rmlvo, FALSE); XkbGetRulesDflts(&rmlvo); /* Make a backup copy */ @@ -160,12 +164,16 @@ xkb_set_get_rules_test(void) assert(strcmp(rmlvo.variant, rmlvo_backup.variant) == 0); assert(strcmp(rmlvo.options, rmlvo_backup.options) == 0); + XkbFreeRMLVOSet(&rmlvo, FALSE); XkbGetRulesDflts(&rmlvo); assert(strcmp(rmlvo.rules, rmlvo_backup.rules) == 0); assert(strcmp(rmlvo.model, rmlvo_backup.model) == 0); assert(strcmp(rmlvo.layout, rmlvo_backup.layout) == 0); assert(strcmp(rmlvo.variant, rmlvo_backup.variant) == 0); assert(strcmp(rmlvo.options, rmlvo_backup.options) == 0); + + XkbFreeRMLVOSet(&rmlvo, FALSE); + XkbFreeRMLVOSet(&rmlvo_backup, FALSE); } int diff --git a/test/xfree86.c b/test/xfree86.c index 59e371633..76837d57e 100644 --- a/test/xfree86.c +++ b/test/xfree86.c @@ -63,17 +63,24 @@ xfree86_option_list_duplicate(void) assert(strcmp(val1, v1) == 0); assert(strcmp(val1, val2) == 0); + free(val1); + free(val2); val1 = xf86CheckStrOption(options, o2, "1"); val2 = xf86CheckStrOption(duplicate, o2, "2"); assert(strcmp(val1, v2) == 0); assert(strcmp(val1, val2) == 0); + free(val1); + free(val2); a = xf86FindOption(options, o_null); b = xf86FindOption(duplicate, o_null); assert(a); assert(b); + + xf86OptionListFree(duplicate); + xf86OptionListFree(options); } static void From 67ef0f083414e761785df9b72602ae23ac1d2ae3 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 4 Jan 2024 12:23:35 +1000 Subject: [PATCH 2/7] test: fix the touch tests to no longer leak Instead of hardcoded TouchRec/ValuatorRec init the devices with the matching functions and go from there. This allows us to clean them up later, removing the various leaks that stop asan from being happy. (cherry picked from commit e44e9262df8b50f76fec3cc371b785473090fb59) --- test/touch.c | 110 +++++++++++++++++++++++++++++++-------------------- 1 file changed, 67 insertions(+), 43 deletions(-) diff --git a/test/touch.c b/test/touch.c index 7b22ceddb..1f183a72a 100644 --- a/test/touch.c +++ b/test/touch.c @@ -35,27 +35,46 @@ #include "tests-common.h" +static void +free_device(DeviceIntPtr dev) +{ + free(dev->name); + free(dev->last.scroll); /* sigh, allocated but not freed by the valuator functions */ + for (int i = 0; i < dev->last.num_touches; i++) + valuator_mask_free(&dev->last.touches[i].valuators); + + free(dev->last.touches); /* sigh, allocated but not freed by the valuator functions */ + FreeDeviceClass(XIValuatorClass, (void**)&dev->valuator); + FreeDeviceClass(XITouchClass, (void**)&dev->touch); +} + static void touch_grow_queue(void) { DeviceIntRec dev; - ValuatorClassRec val; - TouchClassRec touch; + SpriteInfoRec sprite; size_t size, new_size; int i; + ScreenRec screen; + Atom labels[2] = { 0 }; + + screenInfo.screens[0] = &screen; memset(&dev, 0, sizeof(dev)); + dev.type = MASTER_POINTER; /* claim it's a master to stop ptracccel */ dev.name = xnfstrdup("test device"); dev.id = 2; - dev.valuator = &val; - val.numAxes = 5; - dev.touch = &touch; + + InitValuatorClassDeviceStruct(&dev, 2, labels, 10, Absolute); + InitTouchClassDeviceStruct(&dev, 5, XIDirectTouch, 2); + + memset(&sprite, 0, sizeof(sprite)); + dev.spriteInfo = &sprite; + inputInfo.devices = &dev; size = 5; - dev.last.num_touches = size; - dev.last.touches = calloc(dev.last.num_touches, sizeof(*dev.last.touches)); assert(dev.last.touches); for (i = 0; i < size; i++) { dev.last.touches[i].active = TRUE; @@ -91,27 +110,33 @@ touch_grow_queue(void) assert(t->ddx_id == 0); } - free(dev.name); + free_device(&dev); } static void touch_find_ddxid(void) { DeviceIntRec dev; + SpriteInfoRec sprite; DDXTouchPointInfoPtr ti, ti2; - ValuatorClassRec val; - TouchClassRec touch; int size = 5; int i; + Atom labels[2] = { 0 }; + ScreenRec screen; + + screenInfo.screens[0] = &screen; memset(&dev, 0, sizeof(dev)); + dev.type = MASTER_POINTER; /* claim it's a master to stop ptracccel */ dev.name = xnfstrdup("test device"); dev.id = 2; - dev.valuator = &val; - val.numAxes = 5; - dev.touch = &touch; - dev.last.num_touches = size; - dev.last.touches = calloc(dev.last.num_touches, sizeof(*dev.last.touches)); + + InitValuatorClassDeviceStruct(&dev, 2, labels, 10, Absolute); + InitTouchClassDeviceStruct(&dev, 5, XIDirectTouch, 2); + + memset(&sprite, 0, sizeof(sprite)); + dev.spriteInfo = &sprite; + inputInfo.devices = &dev; assert(dev.last.touches); @@ -159,32 +184,35 @@ touch_find_ddxid(void) ti = TouchFindByDDXID(&dev, 40, TRUE); assert(ti == &dev.last.touches[size+1]); - free(dev.name); + free_device(&dev); } static void touch_begin_ddxtouch(void) { DeviceIntRec dev; + SpriteInfoRec sprite; DDXTouchPointInfoPtr ti; - ValuatorClassRec val; - TouchClassRec touch; int ddx_id = 123; unsigned int last_client_id = 0; - int size = 5; + Atom labels[2] = { 0 }; + ScreenRec screen; + + screenInfo.screens[0] = &screen; memset(&dev, 0, sizeof(dev)); + dev.type = MASTER_POINTER; /* claim it's a master to stop ptracccel */ dev.name = xnfstrdup("test device"); dev.id = 2; - dev.valuator = &val; - val.numAxes = 5; - touch.mode = XIDirectTouch; - dev.touch = &touch; - dev.last.num_touches = size; - dev.last.touches = calloc(dev.last.num_touches, sizeof(*dev.last.touches)); inputInfo.devices = &dev; - assert(dev.last.touches); + InitValuatorClassDeviceStruct(&dev, 2, labels, 10, Absolute); + InitTouchClassDeviceStruct(&dev, 5, XIDirectTouch, 2); + + memset(&sprite, 0, sizeof(sprite)); + dev.spriteInfo = &sprite; + + assert(dev.last.touches); ti = TouchBeginDDXTouch(&dev, ddx_id); assert(ti); assert(ti->ddx_id == ddx_id); @@ -206,41 +234,36 @@ touch_begin_ddxtouch(void) assert(!ti->emulate_pointer); last_client_id = ti->client_id; - free(dev.name); + free_device(&dev); } static void touch_begin_touch(void) { DeviceIntRec dev; - TouchClassRec touch; - ValuatorClassRec val; TouchPointInfoPtr ti; int touchid = 12434; int sourceid = 23; SpriteInfoRec sprite; ScreenRec screen; + Atom labels[2] = { 0 }; screenInfo.screens[0] = &screen; memset(&dev, 0, sizeof(dev)); + dev.type = MASTER_POINTER; /* claim it's a master to stop ptracccel */ dev.name = xnfstrdup("test device"); dev.id = 2; - memset(&sprite, 0, sizeof(sprite)); - dev.spriteInfo = &sprite; - - memset(&touch, 0, sizeof(touch)); - touch.num_touches = 0; - - memset(&val, 0, sizeof(val)); - dev.valuator = &val; - val.numAxes = 2; - ti = TouchBeginTouch(&dev, sourceid, touchid, TRUE); assert(!ti); - dev.touch = &touch; + InitValuatorClassDeviceStruct(&dev, 2, labels, 10, Absolute); + InitTouchClassDeviceStruct(&dev, 5, XIDirectTouch, 2); + + memset(&sprite, 0, sizeof(sprite)); + dev.spriteInfo = &sprite; + ti = TouchBeginTouch(&dev, sourceid, touchid, TRUE); assert(ti); assert(ti->client_id == touchid); @@ -248,9 +271,9 @@ touch_begin_touch(void) assert(ti->sourceid == sourceid); assert(ti->emulate_pointer); - assert(touch.num_touches == 1); + assert(dev.touch->num_touches == 5); - free(dev.name); + free_device(&dev); } static void @@ -265,6 +288,7 @@ touch_init(void) screenInfo.screens[0] = &screen; memset(&dev, 0, sizeof(dev)); + dev.type = MASTER_POINTER; /* claim it's a master to stop ptracccel */ dev.name = xnfstrdup("test device"); memset(&sprite, 0, sizeof(sprite)); @@ -279,7 +303,7 @@ touch_init(void) assert(rc == TRUE); assert(dev.touch); - free(dev.name); + free_device(&dev); } int From ed4a6bdff6b31dcb0302881dfae0fbf9513f3809 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 4 Jan 2024 12:30:20 +1000 Subject: [PATCH 3/7] test: fix the xtest device test to show the dependency These two tests were dependent on each other, the second test relied on the xtest devices created in the first test. Let's move the bits that are shared out into the main function instead to illustrate this better. This lets us add a call to CloseDownDevices() that will remove the leaks in this set of tests. (cherry picked from commit b6931f2f5fab52dbb0c09e02ebb8315b3516e01b) --- test/xtest.c | 58 +++++++++++++++++++++++++++------------------------- 1 file changed, 30 insertions(+), 28 deletions(-) diff --git a/test/xtest.c b/test/xtest.c index 12433afc4..171f285f6 100644 --- a/test/xtest.c +++ b/test/xtest.c @@ -62,34 +62,6 @@ device_cursor_cleanup(DeviceIntPtr dev, ScreenPtr screen) static void xtest_init_devices(void) { - ScreenRec screen = {0}; - ClientRec server_client = {0}; - WindowRec root = {{0}}; - WindowOptRec optional = {0}; - - /* random stuff that needs initialization */ - root.drawable.id = 0xab; - root.optional = &optional; - screen.root = &root; - screenInfo.numScreens = 1; - screenInfo.screens[0] = &screen; - screen.myNum = 0; - screen.id = 100; - screen.width = 640; - screen.height = 480; - screen.DeviceCursorInitialize = device_cursor_init; - screen.DeviceCursorCleanup = device_cursor_cleanup; - dixResetPrivates(); - serverClient = &server_client; - InitClient(serverClient, 0, (void *) NULL); - if (!InitClientResources(serverClient)) /* for root resources */ - FatalError("couldn't init server resources"); - InitAtoms(); - SyncExtensionInit(); - - /* this also inits the xtest devices */ - InitCoreDevices(); - assert(xtestpointer); assert(xtestkeyboard); assert(IsXTestDevice(xtestpointer, NULL)); @@ -135,8 +107,38 @@ xtest_properties(void) int xtest_test(void) { + ScreenRec screen = {0}; + ClientRec server_client = {0}; + WindowRec root = {{0}}; + WindowOptRec optional = {0}; + + /* random stuff that needs initialization */ + root.drawable.id = 0xab; + root.optional = &optional; + screen.root = &root; + screenInfo.numScreens = 1; + screenInfo.screens[0] = &screen; + screen.myNum = 0; + screen.id = 100; + screen.width = 640; + screen.height = 480; + screen.DeviceCursorInitialize = device_cursor_init; + screen.DeviceCursorCleanup = device_cursor_cleanup; + dixResetPrivates(); + serverClient = &server_client; + InitClient(serverClient, 0, (void *) NULL); + if (!InitClientResources(serverClient)) /* for root resources */ + FatalError("couldn't init server resources"); + InitAtoms(); + SyncExtensionInit(); + + /* this also inits the xtest devices */ + InitCoreDevices(); + xtest_init_devices(); xtest_properties(); + CloseDownDevices(); + return 0; } From b72a2f0e8a79b37422dc63a5a74a5c7b69c0d333 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sat, 4 Apr 2026 15:01:48 -0700 Subject: [PATCH 4/7] xkb: plug memory leaks in InitKeyboardDeviceStructInternal() error paths MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reported in #1817: xwayland-24.1.6/redhat-linux-build/../xkb/xkbInit.c:527:5: warning[-Wanalyzer-malloc-leak]: leak of ‘rmlvo_dflts.layout’ xwayland-24.1.6/redhat-linux-build/../xkb/xkbInit.c:527:5: warning[-Wanalyzer-malloc-leak]: leak of ‘rmlvo_dflts.model’ xwayland-24.1.6/redhat-linux-build/../xkb/xkbInit.c:527:5: warning[-Wanalyzer-malloc-leak]: leak of ‘rmlvo_dflts.options’ xwayland-24.1.6/redhat-linux-build/../xkb/xkbInit.c:527:5: warning[-Wanalyzer-malloc-leak]: leak of ‘rmlvo_dflts.rules’ xwayland-24.1.6/redhat-linux-build/../xkb/xkbInit.c:527:5: warning[-Wanalyzer-malloc-leak]: leak of ‘rmlvo_dflts.variant’ Fixes: 56a5955c8 ("xkb: strdup the values returned by XkbGetRulesDflts") Signed-off-by: Alan Coopersmith Part-of: (cherry picked from commit 97cf051dfc5770d7b08701c923581e7e53569cd6) --- xkb/xkbInit.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/xkb/xkbInit.c b/xkb/xkbInit.c index 4108e1b26..0178d4da3 100644 --- a/xkb/xkbInit.c +++ b/xkb/xkbInit.c @@ -542,7 +542,7 @@ InitKeyboardDeviceStructInternal(DeviceIntPtr dev, XkbRMLVOSet * rmlvo, dev->key = calloc(1, sizeof(*dev->key)); if (!dev->key) { ErrorF("XKB: Failed to allocate key class\n"); - return FALSE; + goto unwind_rmlvo; } dev->key->sourceid = dev->id; @@ -661,6 +661,8 @@ InitKeyboardDeviceStructInternal(DeviceIntPtr dev, XkbRMLVOSet * rmlvo, unwind_key: free(dev->key); dev->key = NULL; + unwind_rmlvo: + XkbFreeRMLVOSet(&rmlvo_dflts, FALSE); return FALSE; } From 2f983aa82127eb708bd5273ffe808133962165c9 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 28 Nov 2023 16:04:08 +1000 Subject: [PATCH 5/7] xkb: free the filters Direct leak of 960 byte(s) in 6 object(s) allocated from: #0 0x7f00a4ed8cc7 in calloc (/lib64/libasan.so.8+0xd8cc7) (BuildId: 6f17f87dc4c1aa9f9dde7c4856604c3a25ba4872) #1 0x994944 in _XkbNextFreeFilter ../xkb/xkbActions.c:1142 #2 0x9971b3 in SrvXkbLatchModifiers ../xkb/xkbActions.c:1452 #3 0x41dec7 in keyboard_handle_modifiers ../hw/xwayland/xwayland-input.c:1211 #4 0x7f00a4145055 in ffi_call_unix64 (/lib64/libffi.so.8+0x9055) (BuildId: 308041eea4a8d89d9265d3c24b7261dfbe44a61e) Acked-by: Olivier Fourdan (cherry picked from commit 073b90ea5655773a9254b69c6eb8d5afb2bf9e51) --- xkb/xkbInit.c | 1 + 1 file changed, 1 insertion(+) diff --git a/xkb/xkbInit.c b/xkb/xkbInit.c index 0178d4da3..9d1353c2c 100644 --- a/xkb/xkbInit.c +++ b/xkb/xkbInit.c @@ -727,6 +727,7 @@ XkbFreeInfo(XkbSrvInfoPtr xkbi) XkbFreeKeyboard(xkbi->desc, XkbAllComponentsMask, TRUE); xkbi->desc = NULL; } + free(xkbi->filters); free(xkbi); return; } From 3ab0b8834c665d06d0231b0c16359a4f95f0d2c0 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Mon, 1 Jun 2026 21:09:59 +1000 Subject: [PATCH 6/7] vfb: NULL out pXWDHeader after free in freeScreenInfo freeScreenInfo() is called from ddxGiveUp() during normal server shutdown. If the server then aborts (e.g. due to the leak sanitizer detecting leaks at exit), the signal handler calls AbortServer() which calls ddxGiveUp() again, causing a double-free of pXWDHeader. NULL out the pointer after freeing it to make the second call a no-op. --- hw/vfb/InitOutput.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/vfb/InitOutput.c b/hw/vfb/InitOutput.c index 48efb61b2..ee8b70667 100644 --- a/hw/vfb/InitOutput.c +++ b/hw/vfb/InitOutput.c @@ -187,6 +187,7 @@ freeScreenInfo(vfbScreenInfoPtr pvfb) case NORMAL_MEMORY_FB: free(pvfb->pXWDHeader); + pvfb->pXWDHeader = NULL; break; } } From 8a7e0f1e93146c5bfaef989150d4f827718b0da6 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 4 Jan 2024 11:12:28 +1000 Subject: [PATCH 7/7] dix: use valuator_mask_free() to free the last touches vmask No functional effect since that one is just a free() call anyway. (cherry picked from commit 373cd80081cedaa942b42d26d0fecad466ebf7c8) --- dix/devices.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dix/devices.c b/dix/devices.c index 28056a0a8..b15d03116 100644 --- a/dix/devices.c +++ b/dix/devices.c @@ -1041,7 +1041,7 @@ CloseDevice(DeviceIntPtr dev) free(dev->config_info); /* Allocated in xf86ActivateDevice. */ free(dev->last.scroll); for (j = 0; j < dev->last.num_touches; j++) - free(dev->last.touches[j].valuators); + valuator_mask_free(&dev->last.touches[j].valuators); free(dev->last.touches); dev->config_info = NULL; FreePendingFrozenDeviceEvents(dev);