diff options
author | Jukka Rissanen <jukka.rissanen@linux.intel.com> | 2012-06-26 11:29:05 +0300 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2012-06-26 07:53:01 -0700 |
commit | 2b84f61149ce85a0ce3d7d0e9c647c39aedd7187 (patch) | |
tree | 278ba0d43f82ad2d2c5cd52be9fde75c41a92b4c /gweb/gresolv.c | |
parent | a3e24ecbba6aa21bbe496c662e96c4b620e76ac9 (diff) | |
download | connman-2b84f61149ce85a0ce3d7d0e9c647c39aedd7187.tar.gz connman-2b84f61149ce85a0ce3d7d0e9c647c39aedd7187.tar.bz2 connman-2b84f61149ce85a0ce3d7d0e9c647c39aedd7187.zip |
gweb: Use g_try_realloc instead of g_realloc
Diffstat (limited to 'gweb/gresolv.c')
-rw-r--r-- | gweb/gresolv.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/gweb/gresolv.c b/gweb/gresolv.c index cd5a5bf2..e93bf4fc 100644 --- a/gweb/gresolv.c +++ b/gweb/gresolv.c @@ -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)); |