soup-form.c: change some code to make clang happy and to be more obvious
authorDan Winship <danw@gnome.org>
Sat, 23 Jan 2010 21:05:07 +0000 (16:05 -0500)
committerDan Winship <danw@gnome.org>
Sat, 23 Jan 2010 21:06:43 +0000 (16:06 -0500)
based on a suggestion from kov in
https://bugzilla.gnome.org/show_bug.cgi?id=605543

libsoup/soup-form.c

index 7263890..278d845 100644 (file)
@@ -361,22 +361,21 @@ soup_form_request_for_data (const char *method, const char *uri_string,
        if (!strcmp (method, "GET")) {
                g_free (uri->query);
                uri->query = form_data;
-               form_data = NULL;
-       }
 
-       msg = soup_message_new_from_uri (method, uri);
+               msg = soup_message_new_from_uri (method, uri);
+       } else if (!strcmp (method, "POST") || !strcmp (method, "PUT")) {
+               msg = soup_message_new_from_uri (method, uri);
 
-       if (!strcmp (method, "POST") || !strcmp (method, "PUT")) {
                soup_message_set_request (
                        msg, SOUP_FORM_MIME_TYPE_URLENCODED,
                        SOUP_MEMORY_TAKE,
                        form_data, strlen (form_data));
-               form_data = NULL;
-       }
-
-       if (form_data) {
+       } else {
                g_warning ("invalid method passed to soup_form_request_new");
                g_free (form_data);
+
+               /* Don't crash */
+               msg = soup_message_new_from_uri (method, uri);
        }
 
        return msg;