Unify the cleanup paths for error and success.
Now that 'ret' is only set (from tmp) on the success path,
it is safe to jump right before 'return ret' after processing
the error block.
Signed-off-by: Ján Tomko <jtomko@redhat.com>
VIR_STEAL_PTR(ret, tmp);
+ cleanup:
return ret;
error:
for (i = 0; i < ndomains; i++)
VIR_FREE(tmp[i]);
VIR_FREE(tmp);
- return NULL;
+ goto cleanup;
}
VIR_STEAL_PTR(ret, tmp);
+ cleanup:
return ret;
error:
for (i = 0; i < npools; i++)
VIR_FREE(tmp[i]);
VIR_FREE(tmp);
- return NULL;
+ goto cleanup;
}
VIR_STEAL_PTR(ret, tmp);
+ cleanup:
return ret;
error:
VIR_FREE(tmp[i]);
VIR_FREE(tmp);
virStoragePoolFree(pool);
- return NULL;
+ goto cleanup;
}
VIR_STEAL_PTR(ret, tmp);
+ cleanup:
return ret;
error:
for (i = 0; i < nifaces; i++)
VIR_FREE(tmp[i]);
VIR_FREE(tmp);
- return NULL;
+ goto cleanup;
}
VIR_STEAL_PTR(ret, tmp);
+ cleanup:
return ret;
error:
for (i = 0; i < nnets; i++)
VIR_FREE(tmp[i]);
VIR_FREE(tmp);
- return NULL;
+ goto cleanup;
}
VIR_STEAL_PTR(ret, tmp);
+ cleanup:
return ret;
error:
virStringListFree(tmp);
- return NULL;
+ goto cleanup;
}
VIR_STEAL_PTR(ret, tmp);
+ cleanup:
return ret;
error:
for (i = 0; i < ndevs; i++)
VIR_FREE(tmp[i]);
VIR_FREE(tmp);
- return NULL;
+ goto cleanup;
}
VIR_STEAL_PTR(ret, tmp);
+ cleanup:
return ret;
error:
for (i = 0; i < nnwfilters; i++)
VIR_FREE(tmp[i]);
VIR_FREE(tmp);
- return NULL;
+ goto cleanup;
}
VIR_STEAL_PTR(ret, tmp);
+ cleanup:
return ret;
error:
for (i = 0; i < nbindings; i++)
VIR_FREE(tmp[i]);
VIR_FREE(tmp);
- return NULL;
+ goto cleanup;
}
VIR_STEAL_PTR(ret, tmp);
+ cleanup:
return ret;
error:
for (i = 0; i < nsecrets; i++)
VIR_FREE(tmp[i]);
VIR_FREE(tmp);
- return NULL;
+ goto cleanup;
}
VIR_STEAL_PTR(ret, tmp);
+ cleanup:
return ret;
error:
VIR_FREE(tmp[i]);
VIR_FREE(tmp);
virshDomainFree(dom);
- return NULL;
+ goto cleanup;
}
char **
VIR_STEAL_PTR(ret, tmp);
+ cleanup:
return ret;
error:
virStringListFree(tmp);
- return NULL;
+ goto cleanup;
}
VIR_STEAL_PTR(ret, tmp);
+ cleanup:
return ret;
error:
virStringListFree(tmp);
- return NULL;
+ goto cleanup;
}
VIR_STEAL_PTR(ret, tmp);
+ cleanup:
return ret;
error:
virStringListFree(tmp);
- return NULL;
+ goto cleanup;
}
VIR_STEAL_PTR(ret, tmp);
+ cleanup:
return ret;
error:
virStringListFree(tmp);
- return NULL;
+ goto cleanup;
}