From 9b9936f407438a59e843675d59c616905e346c3e Mon Sep 17 00:00:00 2001 From: Pierre Pronchery Date: Fri, 14 Jan 2011 19:51:06 +0000 Subject: [PATCH] Print out the error if the GSM object can't initialize properly --- src/phone.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/phone.c b/src/phone.c index 8e92eec..6483aa8 100644 --- a/src/phone.c +++ b/src/phone.c @@ -1,5 +1,5 @@ /* $Id$ */ -/* Copyright (c) 2010 Pierre Pronchery */ +/* Copyright (c) 2011 Pierre Pronchery */ /* This file is part of DeforaOS Desktop Phone */ /* This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -308,7 +308,7 @@ Phone * phone_new(char const * device, unsigned int baudrate, int retry, fprintf(stderr, "DEBUG: %s(\"%s\", %u)\n", __func__, (device != NULL) ? device : "", baudrate); #endif - if((phone = malloc(sizeof(*phone))) == NULL) + if((phone = object_new(sizeof(*phone))) == NULL) return NULL; _new_config(phone); if(phone->config != NULL) @@ -379,6 +379,7 @@ Phone * phone_new(char const * device, unsigned int baudrate, int retry, /* check errors */ if(phone->gsm == NULL) { + phone_error(NULL, error_get(), 1); phone_delete(phone); return NULL; } @@ -490,7 +491,7 @@ void phone_delete(Phone * phone) pango_font_description_free(phone->bold); if(phone->gsm != NULL) gsm_delete(phone->gsm); - free(phone); + object_delete(phone); }