[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 27/46] util/uri: realloc2n() can't fail, drop dead er
From: |
Michael Tokarev |
Subject: |
[Qemu-devel] [PULL 27/46] util/uri: realloc2n() can't fail, drop dead error handling |
Date: |
Tue, 10 Feb 2015 09:34:16 +0300 |
From: Markus Armbruster <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>
Signed-off-by: Michael Tokarev <address@hidden>
---
util/uri.c | 22 ----------------------
1 file changed, 22 deletions(-)
diff --git a/util/uri.c b/util/uri.c
index aa39694..b9a7b54 100644
--- a/util/uri.c
+++ b/util/uri.c
@@ -1049,14 +1049,12 @@ uri_to_string(URI *uri) {
while (*p != 0) {
if (len >= max) {
temp = realloc2n(ret, &max);
- if (temp == NULL) goto mem_error;
ret = temp;
}
ret[len++] = *p++;
}
if (len >= max) {
temp = realloc2n(ret, &max);
- if (temp == NULL) goto mem_error;
ret = temp;
}
ret[len++] = ':';
@@ -1066,7 +1064,6 @@ uri_to_string(URI *uri) {
while (*p != 0) {
if (len + 3 >= max) {
temp = realloc2n(ret, &max);
- if (temp == NULL) goto mem_error;
ret = temp;
}
if (IS_RESERVED(*(p)) || IS_UNRESERVED(*(p)))
@@ -1083,7 +1080,6 @@ uri_to_string(URI *uri) {
if (uri->server != NULL) {
if (len + 3 >= max) {
temp = realloc2n(ret, &max);
- if (temp == NULL) goto mem_error;
ret = temp;
}
ret[len++] = '/';
@@ -1093,7 +1089,6 @@ uri_to_string(URI *uri) {
while (*p != 0) {
if (len + 3 >= max) {
temp = realloc2n(ret, &max);
- if (temp == NULL) goto mem_error;
ret = temp;
}
if ((IS_UNRESERVED(*(p))) ||
@@ -1112,7 +1107,6 @@ uri_to_string(URI *uri) {
}
if (len + 3 >= max) {
temp = realloc2n(ret, &max);
- if (temp == NULL) goto mem_error;
ret = temp;
}
ret[len++] = '@';
@@ -1121,7 +1115,6 @@ uri_to_string(URI *uri) {
while (*p != 0) {
if (len >= max) {
temp = realloc2n(ret, &max);
- if (temp == NULL) goto mem_error;
ret = temp;
}
ret[len++] = *p++;
@@ -1129,7 +1122,6 @@ uri_to_string(URI *uri) {
if (uri->port > 0) {
if (len + 10 >= max) {
temp = realloc2n(ret, &max);
- if (temp == NULL) goto mem_error;
ret = temp;
}
len += snprintf(&ret[len], max - len, ":%d", uri->port);
@@ -1137,7 +1129,6 @@ uri_to_string(URI *uri) {
} else if (uri->authority != NULL) {
if (len + 3 >= max) {
temp = realloc2n(ret, &max);
- if (temp == NULL) goto mem_error;
ret = temp;
}
ret[len++] = '/';
@@ -1146,7 +1137,6 @@ uri_to_string(URI *uri) {
while (*p != 0) {
if (len + 3 >= max) {
temp = realloc2n(ret, &max);
- if (temp == NULL) goto mem_error;
ret = temp;
}
if ((IS_UNRESERVED(*(p))) ||
@@ -1165,7 +1155,6 @@ uri_to_string(URI *uri) {
} else if (uri->scheme != NULL) {
if (len + 3 >= max) {
temp = realloc2n(ret, &max);
- if (temp == NULL) goto mem_error;
ret = temp;
}
ret[len++] = '/';
@@ -1185,7 +1174,6 @@ uri_to_string(URI *uri) {
(!strcmp(uri->scheme, "file"))) {
if (len + 3 >= max) {
temp = realloc2n(ret, &max);
- if (temp == NULL) goto mem_error;
ret = temp;
}
ret[len++] = *p++;
@@ -1195,7 +1183,6 @@ uri_to_string(URI *uri) {
while (*p != 0) {
if (len + 3 >= max) {
temp = realloc2n(ret, &max);
- if (temp == NULL) goto mem_error;
ret = temp;
}
if ((IS_UNRESERVED(*(p))) || ((*(p) == '/')) ||
@@ -1215,7 +1202,6 @@ uri_to_string(URI *uri) {
if (uri->query != NULL) {
if (len + 1 >= max) {
temp = realloc2n(ret, &max);
- if (temp == NULL) goto mem_error;
ret = temp;
}
ret[len++] = '?';
@@ -1223,7 +1209,6 @@ uri_to_string(URI *uri) {
while (*p != 0) {
if (len + 1 >= max) {
temp = realloc2n(ret, &max);
- if (temp == NULL) goto mem_error;
ret = temp;
}
ret[len++] = *p++;
@@ -1233,7 +1218,6 @@ uri_to_string(URI *uri) {
if (uri->fragment != NULL) {
if (len + 3 >= max) {
temp = realloc2n(ret, &max);
- if (temp == NULL) goto mem_error;
ret = temp;
}
ret[len++] = '#';
@@ -1241,7 +1225,6 @@ uri_to_string(URI *uri) {
while (*p != 0) {
if (len + 3 >= max) {
temp = realloc2n(ret, &max);
- if (temp == NULL) goto mem_error;
ret = temp;
}
if ((IS_UNRESERVED(*(p))) || (IS_RESERVED(*(p))))
@@ -1257,15 +1240,10 @@ uri_to_string(URI *uri) {
}
if (len >= max) {
temp = realloc2n(ret, &max);
- if (temp == NULL) goto mem_error;
ret = temp;
}
ret[len] = 0;
return(ret);
-
-mem_error:
- g_free(ret);
- return(NULL);
}
/**
--
2.1.4
- [Qemu-devel] [PULL 24/46] spapr_vio: Pair g_malloc() with g_free(), not free(), (continued)
- [Qemu-devel] [PULL 24/46] spapr_vio: Pair g_malloc() with g_free(), not free(), Michael Tokarev, 2015/02/10
- [Qemu-devel] [PULL 03/46] Add tracing to xenfb., Michael Tokarev, 2015/02/10
- [Qemu-devel] [PULL 32/46] rtl8139: g_malloc() can't fail, bury dead error handling, Michael Tokarev, 2015/02/10
- [Qemu-devel] [PULL 28/46] util/uri: URI member path can be null, compare more carfully, Michael Tokarev, 2015/02/10
- [Qemu-devel] [PULL 19/46] qemu-sockets: Fix buffer overflow in inet_parse(), Michael Tokarev, 2015/02/10
- [Qemu-devel] [PULL 30/46] Fix name error in migration stream analyzation script, Michael Tokarev, 2015/02/10
- [Qemu-devel] [PULL 13/46] qemu-log: Correct help text of 'log cpu_reset', Michael Tokarev, 2015/02/10
- [Qemu-devel] [PULL 21/46] libcacard: stop linking against every single 3rd party library, Michael Tokarev, 2015/02/10
- [Qemu-devel] [PULL 39/46] migration: Fix warning caused by missing declaration of vmstate_dummy, Michael Tokarev, 2015/02/10
- [Qemu-devel] [PULL 31/46] onenand: g_malloc() can't fail, bury dead error handling, Michael Tokarev, 2015/02/10
- [Qemu-devel] [PULL 27/46] util/uri: realloc2n() can't fail, drop dead error handling,
Michael Tokarev <=
- [Qemu-devel] [PULL 14/46] cpu-exec: drop dead assignment, Michael Tokarev, 2015/02/10
- [Qemu-devel] [PULL 46/46] virtio: Fix warning caused by missing 'static' attribute, Michael Tokarev, 2015/02/10
- [Qemu-devel] [PULL 40/46] migration: Fix warnings caused by missing 'static' attribute, Michael Tokarev, 2015/02/10
- [Qemu-devel] [PULL 05/46] Add/convert trace calls in pcnet-pci.c., Michael Tokarev, 2015/02/10
- [Qemu-devel] [PULL 23/46] qemu-option: Pair g_malloc() with g_free(), not free(), Michael Tokarev, 2015/02/10
- [Qemu-devel] [PULL 33/46] kvm: g_malloc() can't fail, bury dead error handling, Michael Tokarev, 2015/02/10
- [Qemu-devel] [PULL 20/46] linux-user: wrong TARGET_SI_PAD_SIZE value for some targets., Michael Tokarev, 2015/02/10
- [Qemu-devel] [PULL 35/46] vnc: g_realloc() can't fail, bury dead error handling, Michael Tokarev, 2015/02/10