Skip to content

Commit 02a7d45

Browse files
author
Ward Fisher
committed
Coverity 711880 Case #2
1 parent 171dd2f commit 02a7d45

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

oc2/ocrc.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,11 @@ parseproxy(OCstate* state, char* v)
173173
*port_sep = '\0';
174174
host_len = strlen(host_pos);
175175
state->proxy.host = malloc(sizeof(char) * host_len + 1);
176-
if (state->proxy.host == NULL)
177-
return OC_ENOMEM;
176+
if (state->proxy.host == NULL) {
177+
if(port_pos) free(port_pos);
178+
if(host_pos) free(host_pos);
179+
return OC_ENOMEM;
180+
}
178181

179182
strncpy(state->proxy.host, host_pos, host_len);
180183
state->proxy.host[host_len] = '\0';

0 commit comments

Comments
 (0)