Skip to content

Commit

Permalink
modules/kvs: Support zero length raw data
Browse files Browse the repository at this point in the history
Fixes #1232
  • Loading branch information
chu11 committed Oct 16, 2017
1 parent 19d1f30 commit 598fd53
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/modules/kvs/kvs.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,13 +203,15 @@ static void content_load_completion (flux_future_t *f, void *arg)
* this error scenario appropriately.
*/
if (cache_entry_is_type_raw (hp)) {
char *datacpy;
char *datacpy = NULL;

if (!(datacpy = malloc (size))) {
flux_log_error (ctx->h, "%s: malloc", __FUNCTION__);
goto done;
if (size) {
if (!(datacpy = malloc (size))) {
flux_log_error (ctx->h, "%s: malloc", __FUNCTION__);
goto done;
}
memcpy (datacpy, data, size);
}
memcpy (datacpy, data, size);

if (cache_entry_set_raw (hp, datacpy, size) < 0) {
flux_log_error (ctx->h, "%s: cache_entry_set_raw", __FUNCTION__);
Expand Down

0 comments on commit 598fd53

Please sign in to comment.