[LU-10766] Incorrect freeing in llapi_dir_create Created: 05/Mar/18  Updated: 28/Jan/22  Resolved: 15/Apr/18

Status: Resolved
Project: Lustre
Component/s: None
Affects Version/s: Lustre 2.11.0
Fix Version/s: Lustre 2.12.0

Type: Bug Priority: Minor
Reporter: Oleg Drokin Assignee: Oleg Drokin
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Related
is related to LU-15494 DNE3: "lfs setdirstripe -D" for speci... Open
is related to LU-8616 DNE3: enhance "lfs mkdir" to select s... Resolved
Severity: 3
Rank (Obsolete): 9223372036854775807

 Description   

llapi_dir_create has this code:

        dirpath = strdup(name);
        if (!dirpath) {
                free(lmu);
                return -ENOMEM;
        }

        namepath = strdup(name);
        if (!namepath) {
                free(namepath);
                free(lmu);
                return -ENOMEM;
        }

Of course it makes no sense to free() namepath when it was already NULL.
I suspect it was supposed to be freeing dirpath allocated just above it?



 Comments   
Comment by Oleg Drokin [ 05/Mar/18 ]

This was introduced by https://review.whamcloud.com/30566

Comment by Oleg Drokin [ 05/Mar/18 ]

proposed patch in https://review.whamcloud.com/31510

Comment by Gerrit Updater [ 14/Apr/18 ]

Oleg Drokin (oleg.drokin@intel.com) merged in patch https://review.whamcloud.com/31510/
Subject: LU-10766 utils: Correct error handling in llapi_dir_create
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: f01ea62408a2294c76cdddf1dcf1d95fef97c4a2

Comment by Peter Jones [ 15/Apr/18 ]

Landed for 2.12

Generated at Sat Feb 10 02:38:00 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.