gnokii-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gnokii-0.6.30 patch


From: Pawel Kot
Subject: Re: gnokii-0.6.30 patch
Date: Wed, 19 Oct 2011 12:22:55 +0200

Hi,

On Wed, Oct 19, 2011 at 11:29, Alexander V. Lukyanov <address@hidden> wrote:
> On Wed, Oct 19, 2011 at 10:28:51AM +0200, Pawel Kot wrote:
>> --- gnokii-0.6.30/common/phones/nk6510.c      2011-01-23 17:27:32.000000000 
>> +0300
>> +++ gnokii-0.6.30+/common/phones/nk6510.c     2011-03-11 14:02:25.000000000 
>> +0300
>> +             if(!data->message_center)
>> +                     data->message_center = calloc(1, 
>> sizeof(data->message_center[0]));
>>
>> No, I want to avoid it. If (!data->message_center) it should exit with
>> error in this place. It is a responsibility of the caller to allocate
>> it.
>
> Ok, then the caller should be fixed.

Caller looks good to me:
      dt->message_center = calloc (1, sizeof (gn_sms_message_center));
      dt->message_center->id = 1;
      if ((status = gn_sm_functions (GN_OP_GetSMSCenter, dt, sm)) ==
GN_ERR_NONE)
      {
        strcpy (smsc_number, dt->message_center->smsc.number);
        smsc_type = dt->message_center->smsc.type;
      } else {
        smsc_type = -2;
      }
      free (dt->message_center);
Do you have the backctrace and log when it fails?

>>      free (dt->message_center);
>> +    dt->message_center = 0;
>>
>> I'd prefer NULL instead of 0. But that should not matter actually. We
>> allocate the structure unconditionally.
>>
>>    free (dt->sms->reference);
>> +  dt->sms->reference=0;
>> +  dt->sms->parts=0;
>>    free (dt);
>>
>> Does not make sense as we free() it right after.
>
> It's not quite so. dt->sms is not free'd.

Right. Because it is static. And no need to zero the parts then. Did
you have any problems because of that?

>> Can you please disclose your name for the changelogging purposes?
>
> Sure, I have sent original mail from root by accident.

Thanks.

take care,
-- 
Pawel Kot



reply via email to

[Prev in Thread] Current Thread [Next in Thread]