From fc04a161a91e2ba46f093a9e20895754a7f7c526 Mon Sep 17 00:00:00 2001 From: Patrick Marlier Date: Tue, 4 Dec 2012 09:06:06 +0100 Subject: [PATCH] g_malloc never returns if it cannot allocate memory --- libfprint/drivers/aes1660.c | 9 --------- libfprint/drivers/aes2550.c | 4 ---- libfprint/drivers/aes2660.c | 9 --------- 3 files changed, 22 deletions(-) diff --git a/libfprint/drivers/aes1660.c b/libfprint/drivers/aes1660.c index e647ea5..250ca52 100644 --- a/libfprint/drivers/aes1660.c +++ b/libfprint/drivers/aes1660.c @@ -48,16 +48,7 @@ static int dev_init(struct fp_img_dev *dev, unsigned long driver_data) } dev->priv = aesdev = g_malloc0(sizeof(struct aesX660_dev)); - if (!aesdev) - return -ENOMEM; - aesdev->buffer = g_malloc0(AES1660_FRAME_SIZE + AESX660_HEADER_SIZE); - if (!aesdev->buffer) { - g_free(aesdev); - dev->priv = NULL; - return -ENOMEM; - } - aesdev->h_scale_factor = SCALE_FACTOR; aesdev->init_seqs[0] = aes1660_init_1; aesdev->init_seqs_len[0] = array_n_elements(aes1660_init_1); diff --git a/libfprint/drivers/aes2550.c b/libfprint/drivers/aes2550.c index 96ce590..dcfbc82 100644 --- a/libfprint/drivers/aes2550.c +++ b/libfprint/drivers/aes2550.c @@ -215,10 +215,6 @@ static int process_strip_data(struct fpi_ssm *ssm, unsigned char *data) fp_dbg("Bogus frame len: %.4x\n", len); } stripdata = g_malloc(FRAME_WIDTH * FRAME_HEIGHT / 2); /* 4 bits per pixel */ - if (!stripdata) { - fpi_ssm_mark_aborted(ssm, -ENOMEM); - return -ENOMEM; - } memcpy(stripdata, data + 33, FRAME_WIDTH * FRAME_HEIGHT / 2); aesdev->strips = g_slist_prepend(aesdev->strips, stripdata); aesdev->strips_len++; diff --git a/libfprint/drivers/aes2660.c b/libfprint/drivers/aes2660.c index bc1dd00..4be7475 100644 --- a/libfprint/drivers/aes2660.c +++ b/libfprint/drivers/aes2660.c @@ -47,16 +47,7 @@ static int dev_init(struct fp_img_dev *dev, unsigned long driver_data) } dev->priv = aesdev = g_malloc0(sizeof(struct aesX660_dev)); - if (!aesdev) - return -ENOMEM; - aesdev->buffer = g_malloc0(AES2660_FRAME_SIZE + AESX660_HEADER_SIZE); - if (!aesdev->buffer) { - g_free(aesdev); - dev->priv = NULL; - return -ENOMEM; - } - /* No scaling for AES2660 */ aesdev->h_scale_factor = 1; aesdev->init_seqs[0] = aes2660_init_1; -- 1.7.10.4