mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-11 05:17:44 +03:00
udev-builtin-blkid: Use _cleanup_blkid_free_probe_ to free probe (#6108)
Use the _cleanup_blkid_free_probe_ to guarantee that the blkid_probe will be freed when builtin_blkid exits.
This commit is contained in:
parent
c620f9b90b
commit
a1bb2402cb
@ -30,6 +30,7 @@
|
|||||||
#include "sd-id128.h"
|
#include "sd-id128.h"
|
||||||
|
|
||||||
#include "alloc-util.h"
|
#include "alloc-util.h"
|
||||||
|
#include "blkid-util.h"
|
||||||
#include "efivars.h"
|
#include "efivars.h"
|
||||||
#include "fd-util.h"
|
#include "fd-util.h"
|
||||||
#include "gpt.h"
|
#include "gpt.h"
|
||||||
@ -225,7 +226,7 @@ static int builtin_blkid(struct udev_device *dev, int argc, char *argv[], bool t
|
|||||||
int64_t offset = 0;
|
int64_t offset = 0;
|
||||||
bool noraid = false;
|
bool noraid = false;
|
||||||
_cleanup_close_ int fd = -1;
|
_cleanup_close_ int fd = -1;
|
||||||
blkid_probe pr;
|
_cleanup_blkid_free_probe_ blkid_probe pr = NULL;
|
||||||
const char *data;
|
const char *data;
|
||||||
const char *name;
|
const char *name;
|
||||||
const char *prtype = NULL;
|
const char *prtype = NULL;
|
||||||
@ -321,7 +322,6 @@ static int builtin_blkid(struct udev_device *dev, int argc, char *argv[], bool t
|
|||||||
if (is_gpt)
|
if (is_gpt)
|
||||||
find_gpt_root(dev, pr, test);
|
find_gpt_root(dev, pr, test);
|
||||||
|
|
||||||
blkid_free_probe(pr);
|
|
||||||
out:
|
out:
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
Loading…
Reference in New Issue
Block a user