Skip to content

Commit

Permalink
scratchtool.c: fix resource leak
Browse files Browse the repository at this point in the history
CID 1219612 (ceph#1 - 3): Resource leak (RESOURCE_LEAK)
 leaked_storage: Variable iter going out of scope leaks the
 storage it points to.

Signed-off-by: Danny Al-Gaaf <[email protected]>
  • Loading branch information
dalgaaf committed Jun 26, 2014
1 parent 56cad1a commit bdb1346
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/tools/scratchtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ static int do_rados_getxattrs(rados_ioctx_t io_ctx, const char *oid,
if (ret) {
printf("rados_getxattrs(%s): rados_getxattrs_next "
"returned error %d\n", oid, ret);
return 1;
goto out_err;
}
if (!key)
break;
Expand All @@ -87,17 +87,21 @@ static int do_rados_getxattrs(rados_ioctx_t io_ctx, const char *oid,
printf("rados_getxattrs(%s): got key %s, but the "
"value was %s rather than %s.\n",
oid, key, val, exvals[i]);
return 1;
goto out_err;
}
}
if (nfound != nval) {
printf("rados_getxattrs(%s): only found %d extended attributes. "
"Expected %d\n", oid, nfound, nval);
return 1;
goto out_err;
}
rados_getxattrs_end(iter);
printf("rados_getxattrs(%s)\n", oid);
return 0;

out_err:
rados_getxattrs_end(iter);
return 1;
}

static int testrados(void)
Expand Down

0 comments on commit bdb1346

Please sign in to comment.