Set zero-length strings to NULL.
Showing
1 changed file
with
4 additions
and
1 deletions
... | @@ -170,9 +170,12 @@ url_parse (url_t url) | ... | @@ -170,9 +170,12 @@ url_parse (url_t url) |
170 | 170 | ||
171 | 171 | ||
172 | #define UALLOC(X) \ | 172 | #define UALLOC(X) \ |
173 | if(u.X && (url->X = url_decode(u.X)) == 0) { \ | 173 | if(u.X && u.X[0] && (url->X = url_decode(u.X)) == 0) { \ |
174 | err = ENOMEM; \ | 174 | err = ENOMEM; \ |
175 | goto CLEANUP; \ | 175 | goto CLEANUP; \ |
176 | } else { \ | ||
177 | /* Set zero-length strings to NULL. */ \ | ||
178 | u.X = NULL; \ | ||
176 | } | 179 | } |
177 | 180 | ||
178 | UALLOC (scheme) | 181 | UALLOC (scheme) | ... | ... |
-
Please register or sign in to post a comment