Code cleanup

This commit is contained in:
Pierre Pronchery 2007-08-23 04:19:17 +00:00
parent c3768daa22
commit cb877a0a5d

View File

@ -41,6 +41,8 @@ Account * account_new(char const * type, char const * name)
Account * account; Account * account;
char * filename; char * filename;
if(type == NULL || name == NULL || strlen(name) == 0)
return NULL;
if((account = calloc(1, sizeof(*account))) == NULL) if((account = calloc(1, sizeof(*account))) == NULL)
return NULL; return NULL;
if((account->name = strdup(name)) == NULL if((account->name = strdup(name)) == NULL
@ -74,9 +76,16 @@ void account_delete(Account * account)
if(account->plugin->config != NULL) if(account->plugin->config != NULL)
for(p = account->plugin->config; p->name != NULL; p++) for(p = account->plugin->config; p->name != NULL; p++)
if(p->type == ACT_STRING || p->type == ACT_PASSWORD switch(p->type)
|| p->type == ACT_FILE) {
free(p->value); case ACT_STRING:
case ACT_PASSWORD:
case ACT_FILE:
free(p->value);
break;
default:
break;
}
free(account->name); free(account->name);
free(account->title); free(account->title);
dlclose(account->handle); dlclose(account->handle);