warc: Fix a problem under OS X.

This commit is contained in:
Steven Schweda 2011-11-05 11:52:51 +01:00 committed by Giuseppe Scrivano
parent 5305f18c0a
commit eed850d938
2 changed files with 13 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2011-11-04 Steven Schweda <address@hidden>
* warc.c [! WINDOWS]: Include <libgen.h>.
(warc_write_warcinfo_record): Assign a new allocated buffer and
free it on errors.
2011-11-01 Steven Schweda <address@hidden> 2011-11-01 Steven Schweda <address@hidden>
* gnutls.c (ssl_init): Ensure GNU TLS is loaded only once. * gnutls.c (ssl_init): Ensure GNU TLS is loaded only once.

View File

@ -19,6 +19,10 @@
#include <uuid/uuid.h> #include <uuid/uuid.h>
#endif #endif
#ifndef WINDOWS
#include <libgen.h>
#endif
#include "warc.h" #include "warc.h"
extern char *version_string; extern char *version_string;
@ -605,7 +609,7 @@ warc_write_warcinfo_record (char *filename)
char *filename_copy, *filename_basename; char *filename_copy, *filename_basename;
filename_copy = strdup (filename); filename_copy = strdup (filename);
filename_basename = basename (filename_copy); filename_basename = strdup (basename (filename_copy));
warc_write_start_record (); warc_write_start_record ();
warc_write_header ("WARC-Type", "warcinfo"); warc_write_header ("WARC-Type", "warcinfo");
@ -619,6 +623,7 @@ warc_write_warcinfo_record (char *filename)
if (warc_tmp == NULL) if (warc_tmp == NULL)
{ {
free (filename_copy); free (filename_copy);
free (filename_basename);
return false; return false;
} }
@ -646,6 +651,7 @@ warc_write_warcinfo_record (char *filename)
} }
free (filename_copy); free (filename_copy);
free (filename_basename);
fclose (warc_tmp); fclose (warc_tmp);
return warc_write_ok; return warc_write_ok;
} }