[vlc-commits] [Git][videolan/vlc][master] udisk: fix crash when sd_bus_open_system fails

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Sun Feb 9 08:51:56 UTC 2025



Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC


Commits:
99a167eb by Pierre Lamot at 2025-02-09T07:17:39+00:00
udisk: fix crash when sd_bus_open_system fails

p_sys wasn't zero initialized, if the `sd_bus_open_system` call fails, the
cleanup code would try to use the uninitialized `sd_bus` pointer

- - - - -


1 changed file:

- modules/services_discovery/udisks.c


Changes:

=====================================
modules/services_discovery/udisks.c
=====================================
@@ -463,7 +463,7 @@ static void *Run(void *p_obj)
 static int Open(vlc_object_t *p_obj)
 {
     services_discovery_t *sd = (services_discovery_t *)p_obj;
-    struct discovery_sys *p_sys = vlc_alloc(1, sizeof(struct discovery_sys));
+    struct discovery_sys *p_sys = vlc_obj_calloc(p_obj, 1, sizeof(struct discovery_sys));
     struct device_info *info = NULL;
     if (!p_sys)
         return VLC_ENOMEM;
@@ -525,7 +525,6 @@ error:
         sd_bus_close(p_sys->bus);
     }
     sd_bus_error_free(&err);
-    free(p_sys);
     return VLC_EGENERIC;
 }
 
@@ -540,7 +539,6 @@ static void Close(vlc_object_t *p_obj)
     vlc_cancel(p_sys->thread);
     vlc_join(p_sys->thread, NULL);
     vlc_dictionary_clear(&p_sys->entries, FreeEntries, sd);
-    free(p_sys);
 }
 
 VLC_SD_PROBE_HELPER("udisks", N_("UDisks2"), SD_CAT_DEVICES)



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/99a167ebc5e0aa3e0b8eeb813da317b3b08ff5e9

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/99a167ebc5e0aa3e0b8eeb813da317b3b08ff5e9
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list