tests: sniffing: Avoid loop with uninitialised length
authorRobert Swain <robert.swain@collabora.co.uk>
Tue, 31 Jan 2012 12:58:56 +0000 (13:58 +0100)
committerSimon McVittie <simon.mcvittie@collabora.co.uk>
Wed, 8 Feb 2012 10:06:58 +0000 (10:06 +0000)
[This would only happen if a request was made to an unhandled path,
which this test doesn't do, but it seems reasonable to return an empty
response rather than crashing. -smcv]

Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Dan Winship <danw@gnome.org>
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=669479
Bug-NB: NB#297634

tests/sniffing-test.c

index 828f1d5..2812334 100644 (file)
@@ -23,7 +23,7 @@ server_callback (SoupServer *server, SoupMessage *msg,
        GError *error = NULL;
        char *query_key;
        char *contents;
-       gsize length, offset;
+       gsize length = 0, offset;
        gboolean empty_response = FALSE;
 
        if (msg->method != SOUP_METHOD_GET) {