Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 893235 Details for
Bug 1091677
Issues reported by Cppcheck static analysis tool
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
diff from the fix I was working on
diff.out (text/plain), 15.57 KB, created by
Kaleb KEITHLEY
on 2014-05-07 12:16:06 UTC
(
hide
)
Description:
diff from the fix I was working on
Filename:
MIME Type:
Creator:
Kaleb KEITHLEY
Created:
2014-05-07 12:16:06 UTC
Size:
15.57 KB
patch
obsolete
>diff --git a/contrib/uuid/gen_uuid.c b/contrib/uuid/gen_uuid.c >index 79923cd..af2a36f 100644 >--- a/contrib/uuid/gen_uuid.c >+++ b/contrib/uuid/gen_uuid.c >@@ -48,12 +48,11 @@ > #ifdef __APPLE__ > #define PRI_TIME "ld" > #define PRI_TIME_USEC "d" >-#define SCAN_TIME "lu" > #else > #define PRI_TIME "lu" > #define PRI_TIME_USEC "lu" >-#define SCAN_TIME "ld" > #endif >+#define SCAN_TIME "lu" > > > #include <stdio.h> >diff --git a/libglusterfs/src/xlator.c b/libglusterfs/src/xlator.c >index 1bded6d..4f8b8b2 100644 >--- a/libglusterfs/src/xlator.c >+++ b/libglusterfs/src/xlator.c >@@ -647,7 +647,7 @@ out: > char* > loc_gfid_utoa (loc_t *loc) > { >- uuid_t gfid; >+ uuid_t gfid = {0, }; > loc_gfid (loc, gfid); > return uuid_utoa (gfid); > } >diff --git a/xlators/cluster/dht/src/dht-rebalance.c b/xlators/cluster/dht/src/dht-rebalance.c >index 4f78f52..6638b91 100644 >--- a/xlators/cluster/dht/src/dht-rebalance.c >+++ b/xlators/cluster/dht/src/dht-rebalance.c >@@ -1716,7 +1716,7 @@ out: > { > status = dict_new (); > gf_defrag_status_get (defrag, status); >- if (ctx->notify) >+ if (ctx && ctx->notify) > ctx->notify (GF_EN_DEFRAG_STATUS, status); > if (status) > dict_unref (status); >diff --git a/xlators/cluster/stripe/src/stripe.c b/xlators/cluster/stripe/src/stripe.c >index 0ebea81..e60c532 100644 >--- a/xlators/cluster/stripe/src/stripe.c >+++ b/xlators/cluster/stripe/src/stripe.c >@@ -4836,7 +4836,7 @@ stripe_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this, > gf_dirent_t *tmp_entry = NULL; > xlator_list_t *trav = NULL; > loc_t loc = {0, }; >- int32_t count = 0; >+ int32_t count = -1; > stripe_private_t *priv = NULL; > int32_t subvols = 0; > dict_t *xattrs = NULL; >@@ -4947,6 +4947,7 @@ out: > return 0; > > } >+ > int32_t > stripe_readdirp (call_frame_t *frame, xlator_t *this, > fd_t *fd, size_t size, off_t off, dict_t *xdata) >diff --git a/xlators/features/changelog/src/changelog.c b/xlators/features/changelog/src/changelog.c >index 5eb2cd9..51005d3 100644 >--- a/xlators/features/changelog/src/changelog.c >+++ b/xlators/features/changelog/src/changelog.c >@@ -1992,14 +1992,16 @@ init (xlator_t *this) > if (ret) { > if (this->local_pool) > mem_pool_destroy (this->local_pool); >- if (priv->cb) { >- ret = priv->cb->dtor (this, &priv->cd); >- if (ret) >- gf_log (this->name, GF_LOG_ERROR, >- "error in cleanup during init()"); >+ if (priv) { >+ if (priv->cb) { >+ ret = priv->cb->dtor (this, &priv->cd); >+ if (ret) >+ gf_log (this->name, GF_LOG_ERROR, >+ "error in cleanup during init()"); >+ } >+ GF_FREE (priv->changelog_brick); >+ GF_FREE (priv->changelog_dir); > } >- GF_FREE (priv->changelog_brick); >- GF_FREE (priv->changelog_dir); > if (cond_lock_init) > changelog_pthread_destroy (priv); > >diff --git a/xlators/mgmt/glusterd/src/glusterd-geo-rep.c b/xlators/mgmt/glusterd/src/glusterd-geo-rep.c >index 29022a3..bd6c449 100644 >--- a/xlators/mgmt/glusterd/src/glusterd-geo-rep.c >+++ b/xlators/mgmt/glusterd/src/glusterd-geo-rep.c >@@ -1663,20 +1663,12 @@ glusterd_op_stage_sys_exec (dict_t *dict, char **op_errstr) > conf = this->private; > GF_ASSERT (conf); > >- if (conf->op_version < 2) { >- gf_log ("", GF_LOG_ERROR, "Op Version not supported."); >- snprintf (errmsg, sizeof(errmsg), "One or more nodes do not" >- " support the required op version."); >- *op_errstr = gf_strdup (errmsg); >- ret = -1; >- goto out; >- } >- > ret = dict_get_str (dict, "command", &command); > if (ret) { > strcpy (errmsg, "internal error"); > gf_log ("", GF_LOG_ERROR, > "Unable to get command from dict"); >+ ret = -1; > goto out; > } > >@@ -1687,6 +1679,15 @@ glusterd_op_stage_sys_exec (dict_t *dict, char **op_errstr) > goto out; > } > >+ if (conf->op_version < 2) { >+ gf_log ("", GF_LOG_ERROR, "Op Version not supported."); >+ snprintf (errmsg, sizeof(errmsg), "One or more nodes do not" >+ " support the required op version."); >+ *op_errstr = gf_strdup (errmsg); >+ ret = -1; >+ goto out; >+ } >+ > sprintf (command_path, GSYNCD_PREFIX"/peer_%s", command); > /* check if it's executable */ > ret = access (command_path, X_OK); >@@ -1700,7 +1701,7 @@ out: > if (ret) { > if (errmsg[0] == '\0') > snprintf (errmsg, sizeof (errmsg), "%s not found.", >- command); >+ command ? command : "<missing command>" ); > *op_errstr = gf_strdup (errmsg); > gf_log ("", GF_LOG_ERROR, "%s", errmsg); > } >diff --git a/xlators/mgmt/glusterd/src/glusterd-mgmt-handler.c b/xlators/mgmt/glusterd/src/glusterd-mgmt-handler.c >index 81c5aa5..32908a0 100644 >--- a/xlators/mgmt/glusterd/src/glusterd-mgmt-handler.c >+++ b/xlators/mgmt/glusterd/src/glusterd-mgmt-handler.c >@@ -191,10 +191,9 @@ glusterd_handle_mgmt_v3_lock_fn (rpcsvc_request_t *req) > out: > > if (ret || free_ctx) { >- if (ctx->dict) >+ if (ctx && ctx->dict) > dict_unref (ctx->dict); >- if (ctx) >- GF_FREE (ctx); >+ GF_FREE (ctx); > } > > free (lock_req.dict.dict_val); >@@ -862,10 +861,9 @@ glusterd_handle_mgmt_v3_unlock_fn (rpcsvc_request_t *req) > out: > > if (ret || free_ctx) { >- if (ctx->dict) >+ if (ctx && ctx->dict) > dict_unref (ctx->dict); >- if (ctx) >- GF_FREE (ctx); >+ GF_FREE (ctx); > } > > free (lock_req.dict.dict_val); >diff --git a/xlators/mgmt/glusterd/src/glusterd-replace-brick.c b/xlators/mgmt/glusterd/src/glusterd-replace-brick.c >index 929c86b..7532cf7 100644 >--- a/xlators/mgmt/glusterd/src/glusterd-replace-brick.c >+++ b/xlators/mgmt/glusterd/src/glusterd-replace-brick.c >@@ -921,6 +921,7 @@ rb_generate_client_volfile (glusterd_volinfo_t *volinfo, > ttype = glusterd_get_trans_type_rb (volinfo->transport_type); > if (NULL == ttype){ > ret = -1; >+ fclose (file); > goto out; > } > >@@ -998,6 +999,7 @@ rb_generate_dst_brick_volfile (glusterd_volinfo_t *volinfo, > trans_type = glusterd_get_trans_type_rb (volinfo->transport_type); > if (NULL == trans_type){ > ret = -1; >+ fclose (file); > goto out; > } > >diff --git a/xlators/mgmt/glusterd/src/glusterd-sm.c b/xlators/mgmt/glusterd/src/glusterd-sm.c >index e6ad343..2b8cd11 100644 >--- a/xlators/mgmt/glusterd/src/glusterd-sm.c >+++ b/xlators/mgmt/glusterd/src/glusterd-sm.c >@@ -245,7 +245,8 @@ glusterd_ac_reverse_probe_begin (glusterd_friend_sm_event_t *event, void *ctx) > out: > if (ret) { > GF_FREE (new_event); >- GF_FREE (new_ev_ctx->hostname); >+ if (new_ev_ctx) >+ GF_FREE (new_ev_ctx->hostname); > GF_FREE (new_ev_ctx); > } > gf_log ("", GF_LOG_DEBUG, "returning with %d", ret); >diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot.c b/xlators/mgmt/glusterd/src/glusterd-snapshot.c >index e7972bd..7b3c5a5 100644 >--- a/xlators/mgmt/glusterd/src/glusterd-snapshot.c >+++ b/xlators/mgmt/glusterd/src/glusterd-snapshot.c >@@ -6133,6 +6133,14 @@ glusterd_snapshot_restore_postop (dict_t *dict, int32_t op_ret, > GF_ASSERT (dict); > GF_ASSERT (rsp_dict); > >+ /* TODO: fix this when multiple volume support will come */ >+ ret = dict_get_str (dict, "volname1", &volname); >+ if (ret) { >+ gf_log (this->name, GF_LOG_ERROR, >+ "failed to get volume name"); >+ goto out; >+ } >+ > ret = dict_get_str (dict, "snapname", &name); > if (ret) { > gf_log (this->name, GF_LOG_ERROR, "getting the snap " >@@ -6147,14 +6155,6 @@ glusterd_snapshot_restore_postop (dict_t *dict, int32_t op_ret, > goto out; > } > >- /* TODO: fix this when multiple volume support will come */ >- ret = dict_get_str (dict, "volname1", &volname); >- if (ret) { >- gf_log (this->name, GF_LOG_ERROR, >- "failed to get volume name"); >- goto out; >- } >- > ret = glusterd_volinfo_find (volname, &volinfo); > if (ret) { > gf_log (this->name, GF_LOG_ERROR, >diff --git a/xlators/mgmt/glusterd/src/glusterd-syncop.c b/xlators/mgmt/glusterd/src/glusterd-syncop.c >index 998af71..a906edd 100644 >--- a/xlators/mgmt/glusterd/src/glusterd-syncop.c >+++ b/xlators/mgmt/glusterd/src/glusterd-syncop.c >@@ -1363,6 +1363,8 @@ gd_unlock_op_phase (glusterd_conf_t *conf, glusterd_op_t op, int *op_ret, > > peers = &conf->xaction_peers; > >+ this = THIS; >+ > if (!npeers) { > ret = 0; > goto out; >@@ -1375,7 +1377,6 @@ gd_unlock_op_phase (glusterd_conf_t *conf, glusterd_op_t op, int *op_ret, > goto out; > } > >- this = THIS; > synctask_barrier_init((&args)); > peer_cnt = 0; > if (conf->op_version < GD_OP_VERSION_4) { >diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c >index b955fd9..9e6c988 100644 >--- a/xlators/mgmt/glusterd/src/glusterd-utils.c >+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c >@@ -774,8 +774,10 @@ glusterd_auth_cleanup (glusterd_volinfo_t *volinfo) { > > GF_ASSERT (volinfo); > >+ memset (volinfo->auth.username, 0, strlen (volinfo->auth.username)); > GF_FREE (volinfo->auth.username); > >+ memset (volinfo->auth.password, 0, strlen (volinfo->auth.password)); > GF_FREE (volinfo->auth.password); > } > >@@ -4307,6 +4309,8 @@ glusterd_delete_stale_volume (glusterd_volinfo_t *stale_volinfo, > GF_ASSERT (stale_volinfo); > GF_ASSERT (valid_volinfo); > >+ this = THIS; >+ > /* Copy snap_volumes list from stale_volinfo to valid_volinfo */ > valid_volinfo->snap_count = 0; > list_for_each_entry_safe (voliter, temp_volinfo, >@@ -6415,10 +6419,11 @@ glusterd_brick_start (glusterd_volinfo_t *volinfo, > xlator_t *this = NULL; > glusterd_conf_t *conf = NULL; > >+ this = THIS; >+ > if ((!brickinfo) || (!volinfo)) > goto out; > >- this = THIS; > GF_ASSERT (this); > conf = this->private; > GF_ASSERT (conf); >@@ -7441,10 +7446,11 @@ glusterd_brick_stop (glusterd_volinfo_t *volinfo, > xlator_t *this = NULL; > glusterd_conf_t *conf = NULL; > >+ this = THIS; >+ > if ((!brickinfo) || (!volinfo)) > goto out; > >- this = THIS; > GF_ASSERT (this); > conf = this->private; > GF_ASSERT (conf); >@@ -8204,10 +8210,10 @@ glusterd_get_local_brickpaths (glusterd_volinfo_t *volinfo, char **pathlist) > > ret = count; > out: >- for (i = 0; i < count; i++) { >- GF_FREE (path_tokens[i]); >- path_tokens[i] = NULL; >- } >+ >+ if (path_tokens) >+ for (i = 0; i < count; i++) >+ GF_FREE (path_tokens[i]); > > GF_FREE (path_tokens); > path_tokens = NULL; >@@ -8215,7 +8221,6 @@ out: > if (ret == 0) { > gf_log ("", GF_LOG_DEBUG, "No Local Bricks Present."); > GF_FREE (tmp_path_list); >- tmp_path_list = NULL; > } > > gf_log ("", GF_LOG_DEBUG, "Returning %d", ret); >diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c >index d5ca4d1..cd51f95 100644 >--- a/xlators/mount/fuse/src/fuse-bridge.c >+++ b/xlators/mount/fuse/src/fuse-bridge.c >@@ -3072,6 +3072,8 @@ fuse_setxattr (xlator_t *this, fuse_in_header_t *finh, void *msg) > > priv = this->private; > >+ GET_STATE (this, finh, state); >+ > #ifdef GF_DARWIN_HOST_OS > if (fsi->position) { > gf_log ("glusterfs-fuse", GF_LOG_WARNING, >@@ -3132,7 +3134,6 @@ fuse_setxattr (xlator_t *this, fuse_in_header_t *finh, void *msg) > return; > } > >- GET_STATE (this, finh, state); > state->size = fsi->size; > > fuse_resolve_inode_init (state, &state->resolve, finh->nodeid); >@@ -4680,7 +4681,7 @@ fuse_thread_proc (void *data) > fuse_private_t *priv = NULL; > ssize_t res = 0; > struct iobuf *iobuf = NULL; >- fuse_in_header_t *finh; >+ fuse_in_header_t *finh = NULL; > struct iovec iov_in[2]; > void *msg = NULL; > const size_t msg0_size = sizeof (*finh) + 128; >diff --git a/xlators/nfs/server/src/nfs-common.c b/xlators/nfs/server/src/nfs-common.c >index f74396e..3d7d9ec 100644 >--- a/xlators/nfs/server/src/nfs-common.c >+++ b/xlators/nfs/server/src/nfs-common.c >@@ -85,17 +85,24 @@ nfs_mntpath_to_xlator (xlator_list_t *cl, char *path) > if ((!cl) || (!path)) > return NULL; > >- strncpy (volname, path, MNTPATHLEN); >- pathlen = strlen (volname); >- gf_log (GF_NFS, GF_LOG_TRACE, "Subvolume search: %s", path); >+ pathlen = strlen (path); >+ if (pathlen == 0 || pathlen >= sizeof volname) { >+ gf_log (GF_NFS, GF_LOG_ERROR, >+ "Subvolume search, invalid path: %s", path); >+ return NULL; >+ } >+ strcpy (volname, path); >+ > if (volname[0] == '/') > volptr = &volname[1]; > else > volptr = &volname[0]; > >- if (pathlen && volname[pathlen - 1] == '/') >+ if (volname[pathlen - 1] == '/') > volname[pathlen - 1] = '\0'; > >+ gf_log (GF_NFS, GF_LOG_TRACE, "Subvolume search: %s", volname); >+ > while (cl) { > if (strcmp (volptr, cl->xlator->name) == 0) { > targetxl = cl->xlator; >@@ -106,7 +113,6 @@ nfs_mntpath_to_xlator (xlator_list_t *cl, char *path) > } > > return targetxl; >- > } > > >diff --git a/xlators/performance/quick-read/src/quick-read.c b/xlators/performance/quick-read/src/quick-read.c >index b8b4c53..d5018e6 100644 >--- a/xlators/performance/quick-read/src/quick-read.c >+++ b/xlators/performance/quick-read/src/quick-read.c >@@ -582,16 +582,17 @@ qr_readv_cached (call_frame_t *frame, qr_inode_t *qr_inode, size_t size, > unlock: > UNLOCK (&table->lock); > >- if (op_ret > 0) { >- iov.iov_base = iobuf->ptr; >- iov.iov_len = op_ret; >+ if (iobuf) { >+ if (op_ret > 0) { >+ iov.iov_base = iobuf->ptr; >+ iov.iov_len = op_ret; > >- STACK_UNWIND_STRICT (readv, frame, op_ret, 0, &iov, 1, >- &buf, iobref, xdata); >- } >+ STACK_UNWIND_STRICT (readv, frame, op_ret, 0, &iov, 1, >+ &buf, iobref, xdata); >+ } > >- if (iobuf) > iobuf_unref (iobuf); >+ } > > if (iobref) > iobref_unref (iobref);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 1091677
: 893235