mirror of
https://gitlab.freedesktop.org/libfprint/libfprint.git
synced 2025-11-15 07:38:12 +00:00
lib: Use g_malloc0 instead of g_malloc+memset
This commit is contained in:
@@ -97,9 +97,8 @@ static const char *finger_num_to_str(enum fp_finger finger)
|
||||
static struct fp_print_data *print_data_new(uint16_t driver_id,
|
||||
uint32_t devtype, enum fp_print_data_type type, size_t length)
|
||||
{
|
||||
struct fp_print_data *data = g_malloc(sizeof(*data) + length);
|
||||
struct fp_print_data *data = g_malloc0(sizeof(*data) + length);
|
||||
fp_dbg("length=%zd driver=%02x devtype=%04x", length, driver_id, devtype);
|
||||
memset(data, 0, sizeof(*data));
|
||||
data->driver_id = driver_id;
|
||||
data->devtype = devtype;
|
||||
data->type = type;
|
||||
|
||||
@@ -47,8 +47,7 @@
|
||||
|
||||
struct fp_img *fpi_img_new(size_t length)
|
||||
{
|
||||
struct fp_img *img = g_malloc(sizeof(*img) + length);
|
||||
memset(img, 0, sizeof(*img));
|
||||
struct fp_img *img = g_malloc0(sizeof(*img) + length);
|
||||
fp_dbg("length=%zd", length);
|
||||
img->length = length;
|
||||
return img;
|
||||
|
||||
Reference in New Issue
Block a user