From 02ea975071cee7e0272c75f40be89a9fe0388298 Mon Sep 17 00:00:00 2001 From: "fix94.1" Date: Thu, 23 Feb 2012 19:08:34 +0000 Subject: [PATCH] -fixed broken gamercards, broke in one of the laster revs --- source/network/gcard.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/source/network/gcard.c b/source/network/gcard.c index 9d5fadeb..26c87ca5 100644 --- a/source/network/gcard.c +++ b/source/network/gcard.c @@ -19,10 +19,9 @@ int amount_of_providers = 0; u8 register_card_provider(const char *url, const char *key) { - struct provider *new_providers = (struct provider *) realloc(providers, (amount_of_providers + 1) * sizeof(struct provider)); - if (new_providers != NULL && strlen(url) > 0 && strlen(key) > 0) + if (strlen(url) > 0 && strlen(key) > 0) { - providers = new_providers; + providers = (struct provider *) realloc(providers, (amount_of_providers + 1) * sizeof(struct provider));; memset(&providers[amount_of_providers], 0, sizeof(struct provider)); strncpy((char *) providers[amount_of_providers].url, url, 128); strncpy((char *) providers[amount_of_providers].key, key, 48); @@ -40,9 +39,7 @@ u8 has_enabled_providers() for (i = 0; i < amount_of_providers && providers != NULL; i++) { if (strlen(providers[i].url) > 0 && strlen(providers[i].key) > 0) - { return 1; - } } return 0; } @@ -50,10 +47,10 @@ u8 has_enabled_providers() void add_game_to_card(const char *gameid) { int i; - + char *url = (char *) malloc(MAX_URL_SIZE); // Too much memory, but only like 10 bytes memset(url, 0, sizeof(url)); - + for (i = 0; i < amount_of_providers && providers != NULL; i++) { if (strlen(providers[i].url) > 0 && strlen(providers[i].key) > 0)