refactor: change vcard_print() checks
data is allocated via g_new0() so cannot be NULL here. And it was used before the check already so that didn't make any sense in the first place.
This commit is contained in:
@@ -1229,10 +1229,8 @@ vcard_print(xmpp_ctx_t* ctx, ProfWin* window, char* jid)
|
|||||||
|
|
||||||
_userdata* data = g_new0(_userdata, 1);
|
_userdata* data = g_new0(_userdata, 1);
|
||||||
data->vcard = vcard_new();
|
data->vcard = vcard_new();
|
||||||
if (!data || !data->vcard) {
|
if (!data->vcard) {
|
||||||
if (data) {
|
g_free(data);
|
||||||
g_free(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
cons_show("vCard allocation failed");
|
cons_show("vCard allocation failed");
|
||||||
return;
|
return;
|
||||||
@@ -1379,10 +1377,8 @@ vcard_photo(xmpp_ctx_t* ctx, char* jid, char* filename, int index, gboolean open
|
|||||||
_userdata* data = g_new0(_userdata, 1);
|
_userdata* data = g_new0(_userdata, 1);
|
||||||
data->vcard = vcard_new();
|
data->vcard = vcard_new();
|
||||||
|
|
||||||
if (!data || !data->vcard) {
|
if (!data->vcard) {
|
||||||
if (data) {
|
g_free(data);
|
||||||
free(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
cons_show("vCard allocation failed");
|
cons_show("vCard allocation failed");
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user