From 5c0bdf95bd1c4a16fdfdf93731e427c9fa05a847 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Tue, 26 Jan 2016 16:54:56 +0100 Subject: [PATCH] Fixed another leak --- coreapi/friend.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/coreapi/friend.c b/coreapi/friend.c index 39a883371..c5ab26db2 100644 --- a/coreapi/friend.c +++ b/coreapi/friend.c @@ -919,6 +919,10 @@ int linphone_core_import_friends_from_vcard4_file(LinphoneCore *lc, const char * #ifndef VCARD_ENABLED ms_error("vCard support wasn't enabled at compilation time"); #endif + if (!vcards) { + ms_error("Failed to parse the file %s", vcard_file); + return -1; + } while (vcards != NULL && vcards->data != NULL) { LinphoneVCard *vcard = (LinphoneVCard *)vcards->data; LinphoneFriend *lf = linphone_friend_new_from_vcard(vcard); @@ -927,6 +931,8 @@ int linphone_core_import_friends_from_vcard4_file(LinphoneCore *lc, const char * count++; } linphone_friend_unref(lf); + } else { + linphone_vcard_free(vcard); } vcards = ms_list_next(vcards); }