Fix thinko in open_address
authorSteven Luo <steven+maemo@steven676.net>
Sun, 13 Dec 2009 08:15:41 +0000 (00:15 -0800)
committerSteven Luo <steven+maemo@steven676.net>
Sun, 13 Dec 2009 08:15:41 +0000 (00:15 -0800)
if (!uri && uri[0] = '/') is obviously never going to be true ...
Fix by just giving up in the !uri case.

Strangely enough, I'm not hitting this in testing on the tablet --
perhaps gcc is optimizing out the test?

dbus-server-bindings.c

index 3c7718e..b29b1ab 100644 (file)
@@ -47,7 +47,11 @@ static void open_address(const char *uri) {
        char *new_uri;
        size_t new_uri_len;
 
        char *new_uri;
        size_t new_uri_len;
 
-       if (!uri && uri[0] == '/') {
+       if (!uri)
+               /* Not much to do in this case ... */
+               return;
+
+       if (uri[0] == '/') {
                new_uri_len = strlen("file://") + strlen(uri) + 1;
                if (!(new_uri = calloc(new_uri_len, sizeof(char))))
                        exit(1);
                new_uri_len = strlen("file://") + strlen(uri) + 1;
                if (!(new_uri = calloc(new_uri_len, sizeof(char))))
                        exit(1);