Re: [PATCH V3 3/3] Assemble: cleanup the failure path

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

 




On 08/20/2018 05:09 AM, Guoqing Jiang wrote:
>>
>> Could you try below changes?
>>
>> diff --git a/Assemble.c b/Assemble.c
>> index 23892a3720ac..9d0bc1000f96 100644
>> --- a/Assemble.c
>> +++ b/Assemble.c
>> @@ -1536,6 +1536,11 @@ try_again:
>>                               &most_recent, &bestcnt, &best, inargv);
>>         if (devcnt < 0) {
>>                 mdfd = -3;
>> +               /*
>> +                * devices is already freed in load_devices, so set 
>> devices
>> +                * to NULL to avoid double free devices.
>> +                */
>> +               devices = NULL;
>>                 goto out;
>>         }
>>
> 
> Maybe we need to clean these resources as well in below case.
> 
> @@ -594,6 +594,9 @@ static int load_devices(struct devs *devices, char 
> *devmap,
>                          if (strcmp(c->update, "ppl") == 0 &&
>                              ident->bitmap_fd >= 0) {
>                                  pr_err("PPL is not compatible with 
> bitmap\n");
> +                               close(mdfd);
> +                               free(devices);
> +                               free(devmap);
>                                  return -1;
>                          }
> 

I applied the first diff and the issue is gone.

Thanks,
Mariusz




[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux