You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.1 KiB

  1. From 7265d305c27dee05436a25dc60481ad62e022756 Mon Sep 17 00:00:00 2001
  2. From: illiliti <illiliti@protonmail.com>
  3. Date: Fri, 8 Oct 2021 08:53:04 +0300
  4. Subject: [PATCH 09/15] various: fix memory leaks
  5. Closes: #41
  6. ---
  7. udev_device.c | 2 ++
  8. udev_list.c | 3 +++
  9. 2 files changed, 5 insertions(+)
  10. --- a/udev_device.c
  11. +++ b/udev_device.c
  12. @@ -546,12 +546,14 @@ struct udev_device *udev_device_new_from
  13. }
  14. if (!realpath(syspath, path)) {
  15. + free(subsystem);
  16. return NULL;
  17. }
  18. udev_device = calloc(1, sizeof(*udev_device));
  19. if (!udev_device) {
  20. + free(subsystem);
  21. return NULL;
  22. }
  23. --- a/udev_list.c
  24. +++ b/udev_list.c
  25. @@ -78,6 +78,7 @@ struct udev_list_entry *udev_list_entry_
  26. list_entry2->name = strdup(name);
  27. if (!list_entry2->name) {
  28. + free(list_entry2);
  29. return NULL;
  30. }
  31. @@ -85,6 +86,8 @@ struct udev_list_entry *udev_list_entry_
  32. list_entry2->value = strdup(value);
  33. if (!list_entry2->value) {
  34. + free(list_entry2->name);
  35. + free(list_entry2);
  36. return NULL;
  37. }
  38. }