ctxt->digest_hash = dparams;
if(dparams->digest_init(ctxt->digest_hashctx) != 1) {
+ free(ctxt->digest_hashctx);
free(ctxt);
return NULL;
}
int Curl_digest_final(digest_context *context, unsigned char *result)
{
- (*context->digest_hash->digest_final)(result, context->digest_hashctx);
+ if(result)
+ (*context->digest_hash->digest_final)(result, context->digest_hashctx);
free(context->digest_hashctx);
free(context);
result = malloc(digest_def->dparams->digest_resultlen);
if(!result) {
close(fd);
+ Curl_digest_final(dctx, NULL);
return -1;
}
while(1) {
chksum->digest_def = digest_def;
chksum->digest = digest;
}
+ else
+ free(digest);
return chksum;
}
curl_strequal((*p)->type, "ftp") ||
curl_strequal((*p)->type, "ftps")) {
res = new_metalink_resource((*p)->url);
- tail->next = res;
- tail = res;
+ if(res) {
+ tail->next = res;
+ tail = res;
+ }
+ else {
+ tail = root.next;
+
+ /* clean up the linked list */
+ while(tail) {
+ res = tail->next;
+ free(tail->url);
+ free(tail);
+ tail = res;
+ }
+ free(f->filename);
+ free(f);
+ return NULL;
+ }
}
}
f->resource = root.next;