[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] Fix segfault in unit tests
Update of /home/or/cvsroot/tor/src/or
In directory moria:/tmp/cvs-serv26559/src/or
Modified Files:
config.c test.c
Log Message:
Fix segfault in unit tests
Index: config.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/config.c,v
retrieving revision 1.383
retrieving revision 1.384
diff -u -d -r1.383 -r1.384
--- config.c 8 Aug 2005 21:58:48 -0000 1.383
+++ config.c 9 Aug 2005 18:49:43 -0000 1.384
@@ -1332,6 +1332,13 @@
return newopts;
}
+/** Return a new empty or_options_t. Used for testing. */
+or_options_t *
+options_new(void)
+{
+ return config_alloc(&options_format);
+}
+
/** Set <b>options</b> to hold reasonable defaults for most options.
* Each option defaults to zero. */
void
Index: test.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/test.c,v
retrieving revision 1.189
retrieving revision 1.190
diff -u -d -r1.189 -r1.190
--- test.c 8 Aug 2005 21:58:48 -0000 1.189
+++ test.c 9 Aug 2005 18:49:43 -0000 1.190
@@ -35,6 +35,7 @@
int is_obsolete_version(const char *myversion, const char *start);
size_t read_escaped_data(const char *data, size_t len, int translate_newlines,
char **out);
+or_options_t *options_new(void);
static char temp_dir[256];
@@ -1522,7 +1523,7 @@
int
main(int c, char**v)
{
- or_options_t *options = tor_malloc_zero(sizeof(or_options_t));
+ or_options_t *options = options_new();
network_init();
options_init(options);
set_options(options);