mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-02 01:18:26 +03:00
cleanup: add error message and simplify creation
Report error for malloc failure, and use zeroed allocation to initialize handler structure.
This commit is contained in:
parent
195fe03075
commit
15891d366d
@ -59,14 +59,10 @@ struct dm_event_handler *dm_event_handler_create(void)
|
||||
{
|
||||
struct dm_event_handler *dmevh = NULL;
|
||||
|
||||
if (!(dmevh = dm_malloc(sizeof(*dmevh))))
|
||||
if (!(dmevh = dm_zalloc(sizeof(*dmevh)))) {
|
||||
log_error("Failed to allocate event handler.");
|
||||
return NULL;
|
||||
|
||||
dmevh->dmeventd_path = NULL;
|
||||
dmevh->dso = dmevh->dev_name = dmevh->uuid = NULL;
|
||||
dmevh->major = dmevh->minor = 0;
|
||||
dmevh->mask = 0;
|
||||
dmevh->timeout = 0;
|
||||
}
|
||||
|
||||
return dmevh;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user