form: Check file pointer before dereferencing
authorRobert Swain <robert.swain@collabora.co.uk>
Tue, 31 Jan 2012 13:27:38 +0000 (14:27 +0100)
committerSimon McVittie <simon.mcvittie@collabora.co.uk>
Wed, 8 Feb 2012 10:06:37 +0000 (10:06 +0000)
[It's not documented as being allowed to be NULL, but later in the
function there's a check, and GLib convention is generally that all
'out' parameters are allowed to be NULL whether it makes sense or not. -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

libsoup/soup-form.c

index 9e52793..6db1dd9 100644 (file)
@@ -168,7 +168,8 @@ soup_form_decode_multipart (SoupMessage *msg, const char *file_control_name,
                *filename = NULL;
        if (content_type)
                *content_type = NULL;
-       *file = NULL;
+       if (file)
+               *file = NULL;
 
        form_data_set = g_hash_table_new_full (g_str_hash, g_str_equal,
                                               g_free, g_free);