On 2017/4/22 9:51, Gonglei (Arei) wrote:
>> >> >> On 2017/4/21 20:59, Gonglei (Arei) wrote: >> >>> >>>> -----Original Message----- >>>> From: longpeng >>>> Sent: Monday, April 17, 2017 9:33 AM >>>> To: [email protected] >>>> Cc: Gonglei (Arei); Huangweidong (C); [email protected]; >>>> [email protected]; [email protected]; [email protected]; >> longpeng >>>> Subject: [PATCH v2 for-2.10 13/18] crypto: cipher: add afalg-backend cipher >>>> support >>>> >>>> Adds afalg-backend cipher support: introduces some private APIs >>>> firstly, and then intergrates them into qcrypto_cipher_afalg_driver. >>>> >>>> Signed-off-by: Longpeng(Mike) <[email protected]> >>>> --- >>>> + char *name; >>>> + >>>> + name = qcrypto_afalg_cipher_format_name(alg, mode, errp); >>>> + if (!name) { >>>> + return NULL; >>>> + } >>>> + >>>> + afalg = qcrypto_afalg_comm_alloc(AFALG_TYPE_CIPHER, name, errp); >>>> + if (!afalg) { >>>> + goto error; >>> >>> Leak memory pointed by name. >>> >> >> >> It won't. >> >> If failed, the control flow is error->cleanup->return, and 'name' will be >> freed >> in 'cleanup'. >> >> If this method success, then the control flow is cleanup->return, 'name' will >> also be freed. >> > I see. I suggest you can store the name pointer in afalg, then its easily to > free > it in qcrypto_afalg_comm_free(), and we can get enough information about > the alg/mode if needed. > All right, thanks. :) > Thanks, > -Gonglei > > . > -- Regards, Longpeng(Mike)
