nfs_opendir_cb: plug potential memory leak
authorArne Redlich <arne.redlich@googlemail.com>
Mon, 17 Feb 2014 21:44:47 +0000 (22:44 +0100)
committerRonnie Sahlberg <ronniesahlberg@gmail.com>
Thu, 20 Feb 2014 02:45:33 +0000 (18:45 -0800)
Spotted by clang analyzer.

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
lib/libnfs.c

index 572cd7818a6839d771367019b30dea8ab530c893..61cb29f6c1cc8f3eaf575aabb098f2fd89916020 100644 (file)
@@ -2876,6 +2876,7 @@ static void nfs_opendir_cb(struct rpc_context *rpc, int status, void *command_da
                nfsdirent->name = strdup(entry->name);
                if (nfsdirent->name == NULL) {
                        data->cb(-ENOMEM, nfs, "Failed to allocate dirent->name", data->private_data);
+                       free(nfsdirent);
                        nfs_free_nfsdir(nfsdir);
                        data->continue_data = NULL;
                        free_nfs_cb_data(data);