If there's no work to do, then don't attempt to malloc 0 bytes, and
just return success to the user
Change-Id: I060852a247acb8309c75f3670577561b5a9af591
Reviewed-on: http://gerrit.openafs.org/7099
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
struct rx_connection *tconn;
struct bc_volumeDump *tde;
afs_int32 count, port;
- struct tc_dumpDesc *volDesc = 0;
+ struct tc_dumpDesc *volDesc = NULL;
struct tc_dumpArray volArray;
char *baseNamePtr;
statusP statusPtr;
*/
for (count = 0, tde = dumpTaskPtr->volumes; tde;
tde = tde->next, count++);
- volDesc =
- (struct tc_dumpDesc *)malloc(count * sizeof(struct tc_dumpDesc));
+
+ /* Nothing to dump, so just return success */
+ if (count == 0)
+ goto error_exit;
+
+ volDesc = malloc(count * sizeof(struct tc_dumpDesc));
if (!volDesc) {
afs_com_err(whoami, BC_NOMEM, NULL);
ERROR(BC_NOMEM);