Lalatendu Mohanty
2014-Sep-25 10:15 UTC
[Gluster-users] [3.6.0] New Defects reported by Coverity Scan for GlusterFS
FYI, This run done on the 3.6 branch. To fix these Coverity issues , please check the below link for guidelines: http://www.gluster.org/community/documentation/index.php/Fixing_Issues_Reported_By_Tools_For_Static_Code_Analysis#Coverity Thanks, Lala -------- Original Message -------- Subject: New Defects reported by Coverity Scan for GlusterFS Date: Thu, 25 Sep 2014 02:27:13 -0700 From: scan-admin at coverity.com Hi, Please find the latest report on new defect(s) introduced to GlusterFS found with Coverity Scan. Defect(s) Reported-by: Coverity Scan Showing 20 of 50 defect(s) ** CID 1124760: Resource leak (RESOURCE_LEAK) /xlators/cluster/afr/src/afr-inode-read.c: 1043 in afr_fgetxattr_pathinfo_cbk() ** CID 1124795: Resource leak (RESOURCE_LEAK) /xlators/protocol/client/src/client-helpers.c: 237 in unserialize_rsp_direntp() ** CID 1174824: Resource leak (RESOURCE_LEAK) /xlators/mgmt/glusterd/src/glusterd-store.c: 4112 in glusterd_store_retrieve_peers() ** CID 1124533: Explicit null dereferenced (FORWARD_NULL) /xlators/protocol/client/src/client-rpc-fops.c: 5699 in client3_3_readdir() ** CID 1124749: Resource leak (RESOURCE_LEAK) /xlators/cluster/afr/src/afr-common.c: 2229 in __afr_fd_ctx_set() ** CID 1128922: Resource leak (RESOURCE_LEAK) /xlators/storage/bd/src/bd.c: 167 in bd_lookup_cbk() ** CID 1128921: Resource leak (RESOURCE_LEAK) /xlators/storage/bd/src/bd.c: 1167 in bd_offload_getx_cbk() ** CID 1128920: Resource leak (RESOURCE_LEAK) /xlators/storage/bd/src/bd.c: 248 in bd_readdirp_cbk() ** CID 1128919: Resource leak (RESOURCE_LEAK) /xlators/storage/bd/src/bd.c: 1963 in bd_setattr() ** CID 1128918: Resource leak (RESOURCE_LEAK) /xlators/storage/bd/src/bd.c: 1062 in bd_setx_stat_cbk() ** CID 1128917: Resource leak (RESOURCE_LEAK) /xlators/storage/bd/src/bd.c: 1609 in bd_trunc_setxattr_cbk() ** CID 1124788: Resource leak (RESOURCE_LEAK) /xlators/mgmt/glusterd/src/glusterd-mountbroker.c: 338 in make_ghadoop_mountspec() ** CID 1128916: Resource leak (RESOURCE_LEAK) /xlators/storage/bd/src/bd-helper.c: 347 in bd_validate_bd_xattr() ** CID 1124789: Resource leak (RESOURCE_LEAK) /xlators/mgmt/glusterd/src/glusterd-mountbroker.c: 692 in glusterd_do_mount() ** CID 1124759: Resource leak (RESOURCE_LEAK) /xlators/debug/io-stats/src/io-stats.c: 2926 in init() /xlators/performance/io-threads/src/io-threads.c: 1012 in init() /xlators/mgmt/glusterd/src/glusterd.c: 1559 in init() ** CID 1124787: Resource leak (RESOURCE_LEAK) /xlators/cluster/afr/src/afr-inode-read.c: 1163 in afr_getxattr_pathinfo_cbk() ** CID 1124745: Resource leak (RESOURCE_LEAK) /xlators/storage/posix/src/posix.c: 5867 in init() ** CID 1124731: Resource leak (RESOURCE_LEAK) /xlators/mgmt/glusterd/src/glusterd-brick-ops.c: 990 in _glusterd_restart_gsync_session() ** CID 1124776: Resource leak (RESOURCE_LEAK) /xlators/mgmt/glusterd/src/glusterd-volgen.c: 3227 in nfs_option_handler() ** CID 1124770: Resource leak (RESOURCE_LEAK) /rpc/rpc-lib/src/rpc-transport.c: 341 in rpc_transport_load() ________________________________________________________________________________________________________ *** CID 1124760: Resource leak (RESOURCE_LEAK) /xlators/cluster/afr/src/afr-inode-read.c: 1043 in afr_fgetxattr_pathinfo_cbk() 1037 local->op_errno, nxattr, local->xdata_rsp); 1038 1039 if (nxattr) 1040 dict_unref (nxattr); 1041 } 1042>>> CID 1124760: Resource leak (RESOURCE_LEAK) >>> Variable "xattr_serz" going out of scope leaks the storage it points to.1043 return ret; 1044 } 1045 1046 int32_t 1047 afr_getxattr_pathinfo_cbk (call_frame_t *frame, void *cookie, 1048 xlator_t *this, int32_t op_ret, int32_t op_errno, ________________________________________________________________________________________________________ *** CID 1124795: Resource leak (RESOURCE_LEAK) /xlators/protocol/client/src/client-helpers.c: 237 in unserialize_rsp_direntp() 231 232 trav = trav->nextentry; 233 } 234 235 ret = 0; 236 out:>>> CID 1124795: Resource leak (RESOURCE_LEAK) >>> Variable "buf" going out of scope leaks the storage it points to.237 return ret; 238 } 239 240 int 241 clnt_readdirp_rsp_cleanup (gfs3_readdirp_rsp *rsp) 242 { ________________________________________________________________________________________________________ *** CID 1174824: Resource leak (RESOURCE_LEAK) /xlators/mgmt/glusterd/src/glusterd-store.c: 4112 in glusterd_store_retrieve_peers() 4106 glusterd_peerinfo_cleanup (peerinfo); 4107 4108 if (dir) 4109 closedir (dir); 4110 gf_log ("", GF_LOG_DEBUG, "Returning with %d", ret); 4111>>> CID 1174824: Resource leak (RESOURCE_LEAK) >>> Variable "iter" going out of scope leaks the storage it points to.4112 return ret; 4113 } 4114 4115 /* Bricks for snap volumes are hosted at /var/run/gluster/snaps 4116 * When a volume is restored, it points to the bricks of the snap 4117 * volume it was restored from. Hence on a node restart these ________________________________________________________________________________________________________ *** CID 1124533: Explicit null dereferenced (FORWARD_NULL) /xlators/protocol/client/src/client-rpc-fops.c: 5699 in client3_3_readdir() 5693 } 5694 5695 req.size = args->size; 5696 req.offset = args->offset; 5697 req.fd = remote_fd; 5698>>> CID 1124533: Explicit null dereferenced (FORWARD_NULL) >>> Dereferencing null pointer "local".5699 local->cmd = remote_fd; 5700 5701 memcpy (req.gfid, args->fd->inode->gfid, 16); 5702 GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val), 5703 req.xdata.xdata_len, op_errno, unwind); 5704 ________________________________________________________________________________________________________ *** CID 1124749: Resource leak (RESOURCE_LEAK) /xlators/cluster/afr/src/afr-common.c: 2229 in __afr_fd_ctx_set() 2223 2224 ret = __fd_ctx_set (fd, this, (uint64_t)(long) fd_ctx); 2225 if (ret) 2226 gf_log (this->name, GF_LOG_DEBUG, 2227 "failed to set fd ctx (%p)", fd); 2228 out:>>> CID 1124749: Resource leak (RESOURCE_LEAK) >>> Variable "fd_ctx" going out of scope leaks the storage it points to.2229 return ret; 2230 } 2231 2232 2233 int 2234 afr_fd_ctx_set (xlator_t *this, fd_t *fd) ________________________________________________________________________________________________________ *** CID 1128922: Resource leak (RESOURCE_LEAK) /xlators/storage/bd/src/bd.c: 167 in bd_lookup_cbk() 161 dict_del (xattr, GF_CONTENT_KEY); 162 memcpy (buf, &bdatt->iatt, sizeof (struct iatt)); 163 164 out: 165 BD_STACK_UNWIND (lookup, frame, op_ret, op_errno, inode, buf, 166 xattr, postparent);>>> CID 1128922: Resource leak (RESOURCE_LEAK) >>> Variable "type" going out of scope leaks the storage it points to.167 return 0; 168 } 169 170 /* 171 * bd_lookup: Issues posix_lookup to find out if file is mapped to BD 172 * bd_lookup -> posix_lookup -> bd_lookup_cbk ________________________________________________________________________________________________________ *** CID 1128921: Resource leak (RESOURCE_LEAK) /xlators/storage/bd/src/bd.c: 1167 in bd_offload_getx_cbk() 1161 } 1162 1163 STACK_WIND (frame, bd_offload_setx_cbk, FIRST_CHILD(this), 1164 FIRST_CHILD(this)->fops->setxattr, 1165 local->dloc, local->dict, 0, NULL); 1166>>> CID 1128921: Resource leak (RESOURCE_LEAK) >>> Variable "type" going out of scope leaks the storage it points to.1167 return 0; 1168 1169 out: 1170 if (local->fd) 1171 BD_STACK_UNWIND (fsetxattr, frame, -1, op_errno, NULL); 1172 else ________________________________________________________________________________________________________ *** CID 1128920: Resource leak (RESOURCE_LEAK) /xlators/storage/bd/src/bd.c: 248 in bd_readdirp_cbk() 242 GF_FREE (type); 243 } 244 } 245 246 out: 247 BD_STACK_UNWIND (readdirp, frame, op_ret, op_errno, entries, xdata);>>> CID 1128920: Resource leak (RESOURCE_LEAK) >>> Variable "type" going out of scope leaks the storage it points to.248 return 0; 249 } 250 251 /* 252 * bd_readdirp: In bd_readdirp_cbk if the file and BD_XATTR_SIZE is set 253 * ia_size is updated with the LV(BD_XATTR_SIZE) size ________________________________________________________________________________________________________ *** CID 1128919: Resource leak (RESOURCE_LEAK) /xlators/storage/bd/src/bd.c: 1963 in bd_setattr() 1957 *ck_valid = valid; 1958 1959 STACK_WIND_COOKIE (frame, bd_setattr_cbk, ck_valid, FIRST_CHILD(this), 1960 FIRST_CHILD(this)->fops->setattr, 1961 loc, stbuf, valid, xdata); 1962>>> CID 1128919: Resource leak (RESOURCE_LEAK) >>> Variable "ck_valid" going out of scope leaks the storage it points to.1963 return 0; 1964 out: 1965 BD_STACK_UNWIND (setattr, frame, -1, ENOMEM, NULL, NULL, xdata); 1966 return 0; 1967 } 1968 ________________________________________________________________________________________________________ *** CID 1128918: Resource leak (RESOURCE_LEAK) /xlators/storage/bd/src/bd.c: 1062 in bd_setx_stat_cbk() 1056 local->fd, local->dict, 0, NULL); 1057 else 1058 STACK_WIND (frame, bd_setx_setx_cbk, FIRST_CHILD(this), 1059 FIRST_CHILD(this)->fops->setxattr, 1060 &local->loc, local->dict, 0, NULL); 1061>>> CID 1128918: Resource leak (RESOURCE_LEAK) >>> Variable "param" going out of scope leaks the storage it points to.1062 return 0; 1063 1064 out: 1065 if (local->fd) 1066 BD_STACK_UNWIND (fsetxattr, frame, -1, op_errno, xdata); 1067 else ________________________________________________________________________________________________________ *** CID 1128917: Resource leak (RESOURCE_LEAK) /xlators/storage/bd/src/bd.c: 1609 in bd_trunc_setxattr_cbk() 1603 else 1604 STACK_WIND (frame, bd_trunc_setxattr_setx_cbk, 1605 FIRST_CHILD(this), 1606 FIRST_CHILD(this)->fops->setxattr, 1607 &local->loc, local->dict, 0, NULL); 1608>>> CID 1128917: Resource leak (RESOURCE_LEAK) >>> Variable "bd" going out of scope leaks the storage it points to.1609 return 0; 1610 out: 1611 if (local->fd) 1612 BD_STACK_UNWIND (ftruncate, frame, -1, EIO, NULL, NULL, NULL); 1613 else 1614 BD_STACK_UNWIND (truncate, frame, -1, EIO, NULL, NULL, NULL); ________________________________________________________________________________________________________ *** CID 1124788: Resource leak (RESOURCE_LEAK) /xlators/mgmt/glusterd/src/glusterd-mountbroker.c: 338 in make_ghadoop_mountspec() 332 333 ret = gf_asprintf (&hadoop_mnt_desc, hadoop_mnt_desc_template, 334 server, GF_CLIENT_PID_HADOOP, volname, user); 335 if (ret == -1) 336 return ret; 337>>> CID 1124788: Resource leak (RESOURCE_LEAK) >>> Variable "hadoop_mnt_desc" going out of scope leaks the storage it points to.338 return parse_mount_pattern_desc (mspec, hadoop_mnt_desc); 339 } 340 341 static gf_boolean_t 342 match_comp (char *str, char *patcomp) 343 { ________________________________________________________________________________________________________ *** CID 1128916: Resource leak (RESOURCE_LEAK) /xlators/storage/bd/src/bd-helper.c: 347 in bd_validate_bd_xattr() 341 } 342 343 /* Destination file does not exist */ 344 if (stat (path, &stbuf)) { 345 gf_log (this->name, GF_LOG_WARNING, 346 "lstat failed for path %s", path);>>> CID 1128916: Resource leak (RESOURCE_LEAK) >>> Variable "path" going out of scope leaks the storage it points to.347 return -1; 348 } 349 350 vg = lvm_vg_open (priv->handle, priv->vg, "r", 0); 351 if (!vg) { 352 gf_log (this->name, GF_LOG_WARNING, ________________________________________________________________________________________________________ *** CID 1124789: Resource leak (RESOURCE_LEAK) /xlators/mgmt/glusterd/src/glusterd-mountbroker.c: 692 in glusterd_do_mount() 686 ret = 0; 687 *path = cookie; 688 } 689 690 GF_FREE (mtptemp); 691>>> CID 1124789: Resource leak (RESOURCE_LEAK) >>> Variable "mntlink" going out of scope leaks the storage it points to.692 return ret; ________________________________________________________________________________________________________ *** CID 1124759: Resource leak (RESOURCE_LEAK) /xlators/debug/io-stats/src/io-stats.c: 2926 in init() 2920 out: 2921 if (!this->private) { 2922 ios_conf_destroy (conf); 2923 ret = -1; 2924 } 2925>>> CID 1124759: Resource leak (RESOURCE_LEAK) >>> Variable "conf" going out of scope leaks the storage it points to.2926 return ret; 2927 } 2928 2929 void 2930 fini (xlator_t *this) 2931 { /xlators/performance/io-threads/src/io-threads.c: 1012 in init() 1006 this->private = conf; 1007 ret = 0; 1008 out: 1009 if (ret) 1010 GF_FREE (conf); 1011>>> CID 1124759: Resource leak (RESOURCE_LEAK) >>> Variable "conf" going out of scope leaks the storage it points to.1012 return ret; 1013 } 1014 1015 1016 void 1017 fini (xlator_t *this) /xlators/mgmt/glusterd/src/glusterd.c: 1559 in init() 1553 GF_FREE (this->private); 1554 this->private = NULL; 1555 } 1556 1557 } 1558>>> CID 1124759: Resource leak (RESOURCE_LEAK) >>> Variable "conf" going out of scope leaks the storage it points to.1559 return ret; 1560 } 1561 1562 1563 1564 ________________________________________________________________________________________________________ *** CID 1124787: Resource leak (RESOURCE_LEAK) /xlators/cluster/afr/src/afr-inode-read.c: 1163 in afr_getxattr_pathinfo_cbk() 1157 local->op_errno, nxattr, local->xdata_rsp); 1158 1159 if (nxattr) 1160 dict_unref (nxattr); 1161 } 1162>>> CID 1124787: Resource leak (RESOURCE_LEAK) >>> Variable "xattr_serz" going out of scope leaks the storage it points to.1163 return ret; 1164 } 1165 1166 static int 1167 afr_aggregate_stime_xattr (dict_t *this, char *key, data_t *value, void *data) 1168 { ________________________________________________________________________________________________________ *** CID 1124745: Resource leak (RESOURCE_LEAK) /xlators/storage/posix/src/posix.c: 5867 in init() 5861 } 5862 #endif 5863 5864 GF_OPTION_INIT ("batch-fsync-delay-usec", _private->batch_fsync_delay_usec, 5865 uint32, out); 5866 out:>>> CID 1124745: Resource leak (RESOURCE_LEAK) >>> Variable "_private" going out of scope leaks the storage it points to.5867 return ret; 5868 } 5869 5870 void 5871 fini (xlator_t *this) 5872 { ________________________________________________________________________________________________________ *** CID 1124731: Resource leak (RESOURCE_LEAK) /xlators/mgmt/glusterd/src/glusterd-brick-ops.c: 990 in _glusterd_restart_gsync_session() 984 if (ret) 985 gf_log ("", GF_LOG_ERROR, 986 "Unable to restart gsync session."); 987 988 out: 989 gf_log ("", GF_LOG_DEBUG, "Returning %d.", ret);>>> CID 1124731: Resource leak (RESOURCE_LEAK) >>> Variable "path_list" going out of scope leaks the storage it points to.990 return ret; 991 } 992 993 /* op-sm */ 994 995 int ________________________________________________________________________________________________________ *** CID 1124776: Resource leak (RESOURCE_LEAK) /xlators/mgmt/glusterd/src/glusterd-volgen.c: 3227 in nfs_option_handler() 3221 ret = gf_asprintf (&aa, "nfs3.%s.export-dir", 3222 volinfo->volname); 3223 3224 if (ret != -1) { 3225 ret = gf_canonicalize_path (vme->value); 3226 if (ret)>>> CID 1124776: Resource leak (RESOURCE_LEAK) >>> Variable "aa" going out of scope leaks the storage it points to.3227 return -1; 3228 3229 ret = xlator_set_option (xl, aa, vme->value); 3230 GF_FREE (aa); 3231 } 3232 ________________________________________________________________________________________________________ *** CID 1124770: Resource leak (RESOURCE_LEAK) /rpc/rpc-lib/src/rpc-transport.c: 341 in rpc_transport_load() 335 } 336 337 return_trans = trans; 338 339 GF_FREE (name); 340>>> CID 1124770: Resource leak (RESOURCE_LEAK) >>> Variable "vol_opt" going out of scope leaks the storage it points to.341 return return_trans; 342 343 fail: 344 if (trans) { 345 GF_FREE (trans->name); 346 ________________________________________________________________________________________________________ To view the defects in Coverity Scan visit, http://scan.coverity.com/projects/987?tab=overview To unsubscribe from the email notification for new defects, http://scan5.coverity.com/cgi-bin/unsubscribe.py -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://supercolony.gluster.org/pipermail/gluster-users/attachments/20140925/4949a50a/attachment.html>