diff --git a/src/core/dyad_core.c b/src/core/dyad_core.c index 14cbf99d..7e996d75 100644 --- a/src/core/dyad_core.c +++ b/src/core/dyad_core.c @@ -224,14 +224,14 @@ DYAD_CORE_FUNC_MODS dyad_rc_t dyad_kvs_read (const dyad_ctx_t* restrict ctx, } } size_t topic_len = strlen (topic); - *mdata->fpath = (char*)malloc (topic_len + 1); - if (*mdata->fpath == NULL) { + (*mdata)->fpath = (char*)malloc (topic_len + 1); + if ((*mdata)->fpath == NULL) { DYAD_LOG_ERR (ctx, "Cannot allocate memory for fpath in metadata object"); rc = DYAD_RC_SYSFAIL; goto kvs_read_end; } - memset (*mdata->fpath, '\0', topic_len + 1); - strncpy (*mdata->fpath, topic, topic_len); + memset ((*mdata)->fpath, '\0', topic_len + 1); + strncpy ((*mdata)->fpath, topic, topic_len); rc = flux_kvs_lookup_get_unpack (f, "i", &((*mdata)->owner_rank)); // If the extraction did not work, log an error and return DYAD_BADFETCH if (rc < 0) { @@ -243,8 +243,8 @@ DYAD_CORE_FUNC_MODS dyad_rc_t dyad_kvs_read (const dyad_ctx_t* restrict ctx, kvs_read_end: if (DYAD_IS_ERROR (rc) && mdata != NULL && *mdata != NULL) { - if (*mdata->fpath != NULL) - free (*mdata->fpath); + if ((*mdata)->fpath != NULL) + free ((*mdata)->fpath); free (*mdata); *mdata = NULL; } @@ -257,7 +257,7 @@ DYAD_CORE_FUNC_MODS dyad_rc_t dyad_kvs_read (const dyad_ctx_t* restrict ctx, DYAD_CORE_FUNC_MODS dyad_rc_t dyad_fetch (const dyad_ctx_t* restrict ctx, const char* restrict fname, - dyad_mdata_t** restrict mdata) + dyad_metadata_t** restrict mdata) { dyad_rc_t rc = DYAD_RC_OK; char upath[PATH_MAX]; @@ -301,8 +301,8 @@ DYAD_CORE_FUNC_MODS dyad_rc_t dyad_fetch (const dyad_ctx_t* restrict ctx, "same as the consumer rank\n"); *resp = NULL; if (mdata != NULL && *mdata != NULL) { - if (*mdata->fpath != NULL) - free (*mdata->fpath); + if ((*mdata)->fpath != NULL) + free ((*mdata)->fpath); free (*mdata); *mdata = NULL; } @@ -769,22 +769,22 @@ dyad_rc_t dyad_get_metadata (dyad_ctx_t* ctx, DYAD_LOG_ERR (ctx, "Could not read data from the KVS"); goto get_metadata_done; } - free (*mdata->fpath); + free ((*mdata)->fpath); size_t fname_len = strlen (fname); - *mdata->fpath = (char*)malloc (fname_len + 1); - if (*mdata->fpath == NULL) { + (*mdata)->fpath = (char*)malloc (fname_len + 1); + if ((*mdata)->fpath == NULL) { DYAD_LOG_ERR (ctx, "Could not allocate memory for fpath"); rc = DYAD_RC_SYSFAIL; goto get_metadata_done; } - memset (*mdata->fpath, '\0', fname_len + 1); - strncpy (*mdata->fpath, fname, fname_len); + memset ((*mdata)->fpath, '\0', fname_len + 1); + strncpy ((*mdata)->fpath, fname, fname_len); rc = DYAD_RC_OK; get_metadata_done: if (DYAD_IS_ERROR (rc) && mdata != NULL && *mdata != NULL) { - if (*mdata->fpath != NULL) - free (*mdata->fpath); + if ((*mdata)->fpath != NULL) + free ((*mdata)->fpath); free (*mdata); *mdata = NULL; }