[sr-dev] git:master: lib/srdb1 Prevent crash in case of incorrect parameter

Marius Zbihlei marius.zbihlei at 1and1.ro
Fri Jan 14 16:26:38 CET 2011


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

Author: Marius Zbihlei <marius.zbihlei at 1and1.ro>
Committer: Marius Zbihlei <marius.zbihlei at 1and1.ro>
Date:   Fri Jan 14 17:04:09 2011 +0200

lib/srdb1 Prevent crash in case of incorrect parameter

Reported by clang.

---

 lib/srdb1/db_id.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/lib/srdb1/db_id.c b/lib/srdb1/db_id.c
index 7a8b5d7..2761c65 100644
--- a/lib/srdb1/db_id.c
+++ b/lib/srdb1/db_id.c
@@ -207,12 +207,14 @@ static int parse_db_url(struct db_id* id, const str* url)
 	return 0;
 
  err:
+	if (!id) goto end;
 	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);
 	if (prev_token) pkg_free(prev_token);
+ end:
 	return -1;
 }
 




More information about the sr-dev mailing list