Replace all occurences of free() with xfree()

This commit is contained in:
Darshit Shah 2014-11-27 11:11:34 +05:30
parent 5edc97f3f8
commit 3e609a1192
7 changed files with 37 additions and 32 deletions

View File

@ -1,3 +1,8 @@
2014-11-27 Darshit Shah <darnir@gmail.com>
* cookies.c, gettext.h, init.c, retr.c, url.c, warc.c: Replace usage of
free() with xfree() macro.
2014-11-26 Tim Ruehsen <tim.ruehsen@gmx.de>
* http.c: Select strongest challenge from WWW-Authenticate,

View File

@ -1445,8 +1445,8 @@ test_cookies (void)
printf ("Invalid value %d for '%s' (expected '%s', got '%s')\n",
j / 2 + 1, data, expected[j + 1], v);
j += 2;
free (n);
free (v);
xfree (n);
xfree (v);
}
if (expected[j])
printf ("Too few parameters for '%s'\n", data);

View File

@ -215,7 +215,7 @@ dcpgettext_expr (const char *domain,
translation = dcgettext (domain, msg_ctxt_id, category);
#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
if (msg_ctxt_id != buf)
free (msg_ctxt_id);
xfree (msg_ctxt_id);
#endif
if (translation != msg_ctxt_id)
return translation;
@ -261,7 +261,7 @@ dcnpgettext_expr (const char *domain,
translation = dcngettext (domain, msg_ctxt_id, msgid_plural, n, category);
#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
if (msg_ctxt_id != buf)
free (msg_ctxt_id);
xfree (msg_ctxt_id);
#endif
if (!(translation == msg_ctxt_id || translation == msgid_plural))
return translation;

View File

@ -486,7 +486,7 @@ home_dir (void)
}
ret = home ? xstrdup (home) : NULL;
free (buf);
xfree (buf);
return ret;
}

View File

@ -441,7 +441,7 @@ fd_read_body (const char *downloaded_filename, int fd, FILE *out, wgint toread,
if (qtywritten)
*qtywritten += sum_written;
free (dlbuf);
xfree (dlbuf);
return ret;
}
@ -790,7 +790,7 @@ retrieve_url (struct url * orig_parsed, const char *origurl, char **file,
goto bail;
}
iri_free(pi);
free (proxy);
xfree (proxy);
}
if (u->scheme == SCHEME_HTTP
@ -1099,7 +1099,7 @@ retrieve_from_file (const char *file, bool html, int *count)
cur_url->url->url, &filename,
&new_file, NULL, &dt, opt.recursive, tmpiri,
true);
free(proxy);
xfree (proxy);
if (parsed_url)
url_free (parsed_url);
@ -1298,7 +1298,7 @@ url_uses_proxy (struct url * u)
return false;
proxy = getproxy (u);
ret = proxy != NULL;
free(proxy);
xfree (proxy);
return ret;
}

View File

@ -1643,7 +1643,7 @@ url_file_name (const struct url *u, char *replaced_filename)
logprintf (LOG_NOTQUIET, "New name is %s.\n", temp_fnres.base);
}
free (fname_len_check);
xfree (fname_len_check);
/* The filename has already been 'cleaned' by append_uri_pathel() above. So,
* just append it. */
@ -1656,7 +1656,7 @@ url_file_name (const struct url *u, char *replaced_filename)
/* Make a final check that the path length is acceptable? */
/* TODO: check fnres.base for path length problem */
free (temp_fnres.base);
xfree (temp_fnres.base);
/* Check the cases in which the unique extensions are not used:
1) Clobbering is turned off (-nc).

View File

@ -469,7 +469,7 @@ warc_sha1_stream_with_payload (FILE *stream, void *res_block, void *res_payload,
or EWOULDBLOCK. */
if (ferror (stream))
{
free (buffer);
xfree (buffer);
return 1;
}
goto process_partial_block;
@ -529,7 +529,7 @@ warc_sha1_stream_with_payload (FILE *stream, void *res_block, void *res_payload,
sha1_finish_ctx (&ctx_block, res_block);
if (payload_offset >= 0)
sha1_finish_ctx (&ctx_payload, res_payload);
free (buffer);
xfree (buffer);
return 0;
#undef BLOCKSIZE
@ -571,13 +571,13 @@ warc_write_digest_headers (FILE *file, long payload_offset)
digest = warc_base32_sha1_digest (sha1_res_block);
warc_write_header ("WARC-Block-Digest", digest);
free (digest);
xfree (digest);
if (payload_offset >= 0)
{
digest = warc_base32_sha1_digest (sha1_res_payload);
warc_write_header ("WARC-Payload-Digest", digest);
free (digest);
xfree (digest);
}
}
}
@ -687,8 +687,8 @@ warc_write_warcinfo_record (char *filename)
warc_tmp = warc_tempfile ();
if (warc_tmp == NULL)
{
free (filename_copy);
free (filename_basename);
xfree (filename_copy);
xfree (filename_basename);
return false;
}
@ -714,8 +714,8 @@ warc_write_warcinfo_record (char *filename)
if (! warc_write_ok)
logprintf (LOG_NOTQUIET, _("Error writing warcinfo record to WARC file.\n"));
free (filename_copy);
free (filename_basename);
xfree (filename_copy);
xfree (filename_basename);
fclose (warc_tmp);
return warc_write_ok;
}
@ -755,8 +755,8 @@ warc_start_new_file (bool meta)
if (warc_current_file != NULL)
fclose (warc_current_file);
free (warc_current_warcinfo_uuid_str);
free (warc_current_filename);
xfree (warc_current_warcinfo_uuid_str);
xfree (warc_current_filename);
warc_current_file_number++;
@ -917,7 +917,7 @@ warc_process_cdx_line (char *lineptr, int field_num_original_url,
char * checksum_v;
base32_decode_alloc (checksum, strlen (checksum), &checksum_v,
&checksum_l);
free (checksum);
xfree (checksum);
if (checksum_v != NULL && checksum_l == SHA1_DIGEST_SIZE)
{
@ -928,13 +928,13 @@ warc_process_cdx_line (char *lineptr, int field_num_original_url,
rec->uuid = record_id;
memcpy (rec->digest, checksum_v, SHA1_DIGEST_SIZE);
hash_table_put (warc_cdx_dedup_table, rec->digest, rec);
free (checksum_v);
xfree (checksum_v);
}
else
{
free (original_url);
free (checksum_v);
free (record_id);
xfree (original_url);
xfree (checksum_v);
xfree (record_id);
}
}
else
@ -1015,7 +1015,7 @@ _("CDX file does not list record ids. (Missing column 'u'.)\n"));
nrecords);
}
free (lineptr);
xfree (lineptr);
fclose (f);
return true;
@ -1156,7 +1156,7 @@ warc_close (void)
if (warc_current_file != NULL)
{
warc_write_metadata ();
free (warc_current_warcinfo_uuid_str);
xfree (warc_current_warcinfo_uuid_str);
fclose (warc_current_file);
}
if (warc_current_cdx_file != NULL)
@ -1338,7 +1338,7 @@ warc_write_revisit_record (char *url, char *timestamp_str,
warc_write_end_record ();
fclose (body);
free (block_digest);
xfree (block_digest);
return warc_write_ok;
}
@ -1400,7 +1400,7 @@ warc_write_response_record (char *url, char *timestamp_str,
result = warc_write_revisit_record (url, timestamp_str,
concurrent_to_uuid, payload_digest, rec_existing->uuid,
ip, body);
free (payload_digest);
xfree (payload_digest);
return result;
}
@ -1441,8 +1441,8 @@ warc_write_response_record (char *url, char *timestamp_str,
response_uuid);
}
free (block_digest);
free (payload_digest);
xfree (block_digest);
xfree (payload_digest);
return warc_write_ok;
}