diff options
| author | Claudio Takahasi <claudio.takahasi@openbossa.org> | 2008-03-07 13:00:13 +0000 | 
|---|---|---|
| committer | Claudio Takahasi <claudio.takahasi@openbossa.org> | 2008-03-07 13:00:13 +0000 | 
| commit | 8b415b792063dc548c753c37166dfa104157daee (patch) | |
| tree | da32e111340b3c4cf200472a3decb13ca339673e /common/glib-helper.c | |
| parent | 7e31dd1071053dd326f19633a6f64188c787326d (diff) | |
glib-helper: use g_try_malloc instead of g_malloc
Diffstat (limited to 'common/glib-helper.c')
| -rw-r--r-- | common/glib-helper.c | 8 | 
1 files changed, 5 insertions, 3 deletions
| diff --git a/common/glib-helper.c b/common/glib-helper.c index f4d3f9d4..5938e654 100644 --- a/common/glib-helper.c +++ b/common/glib-helper.c @@ -154,11 +154,13 @@ int bt_discover_services(const bdaddr_t *src, const bdaddr_t *dst,  	s = sdp_connect(src, dst, SDP_NON_BLOCKING);  	if (!s) -		return -EIO; +		return -errno; -	ctxt = g_malloc0(sizeof(struct search_context)); -	if (!ctxt) +	ctxt = g_try_malloc0(sizeof(struct search_context)); +	if (!ctxt) { +		sdp_close(s);  		return -ENOMEM; +	}  	bacpy(&ctxt->src, src);  	bacpy(&ctxt->dst, dst); | 
