gweb: Use g_try_realloc instead of g_realloc
authorJukka Rissanen <jukka.rissanen@linux.intel.com>
Tue, 26 Jun 2012 08:29:05 +0000 (11:29 +0300)
committerMarcel Holtmann <marcel@holtmann.org>
Tue, 26 Jun 2012 14:53:01 +0000 (07:53 -0700)
gweb/gresolv.c

index cd5a5bf..e93bf4f 100644 (file)
@@ -607,8 +607,10 @@ static void add_result(struct resolv_lookup *lookup, int family,
                                                        const void *data)
 {
        int n = lookup->nr_results++;
-       lookup->results = g_realloc(lookup->results,
+       lookup->results = g_try_realloc(lookup->results,
                                        sizeof(struct sort_result) * (n + 1));
+       if (lookup->results == NULL)
+               return;
 
        memset(&lookup->results[n], 0, sizeof(struct sort_result));