Module: sip-router
Branch: 3.1
Commit: bbf59bb235f45e70f8e2925bdf584495610656c5
URL:    
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=bbf59bb235f45e70f8e2925bdf584495610656c5

Author: Marius Zbihlei <[email protected]>
Committer: Marius Zbihlei <[email protected]>
Date:   Wed Apr 27 12:56:58 2011 +0300

lib/srdb1 Fixed crash caused by NULL pointer parameter

---

 lib/srdb1/db_id.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/lib/srdb1/db_id.c b/lib/srdb1/db_id.c
index 1c9c4b5..6e8671e 100644
--- a/lib/srdb1/db_id.c
+++ b/lib/srdb1/db_id.c
@@ -209,12 +209,14 @@ static int parse_db_url(struct db_id* id, const str* url)
        return 0;
 
  err:
-       if (id->scheme) pkg_free(id->scheme);
-       if (id->username) pkg_free(id->username);
-       if (id->password) pkg_free(id->password);
-       if (id->host) pkg_free(id->host);
-       if (id->database) pkg_free(id->database);
-       memset(id, 0, sizeof(struct db_id));
+       if(id){
+               if (id->scheme) pkg_free(id->scheme);
+               if (id->username) pkg_free(id->username);
+               if (id->password) pkg_free(id->password);
+               if (id->host) pkg_free(id->host);
+               if (id->database) pkg_free(id->database);
+               memset(id, 0, sizeof(struct db_id));
+       }
        if (prev_token) pkg_free(prev_token);
        return -1;
 }


_______________________________________________
sr-dev mailing list
[email protected]
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to