From 4145ecbad5b24808ccad1446ca84d65adc7db60b Mon Sep 17 00:00:00 2001 From: Stefan Lankes Date: Sun, 28 Aug 2016 09:46:59 +0200 Subject: [PATCH] some code cleanups --- hermit/tools/proxy.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hermit/tools/proxy.c b/hermit/tools/proxy.c index 5fa696382..ba7a6d66f 100644 --- a/hermit/tools/proxy.c +++ b/hermit/tools/proxy.c @@ -155,6 +155,7 @@ static int is_qemu_available(void) { char* line = (char*) malloc(2048); size_t n = 2048; + int ret = 0; if (!line) { fprintf(stderr, "Not enough memory\n"); @@ -167,16 +168,15 @@ static int is_qemu_available(void) while(getline(&line, &n, file) > 0) { if (strncmp(line, "TCP server listening.\n", 2048) == 0) { - fclose(file); - free(line); - return 1; + ret = 1; + break; } } fclose(file); free(line); - return 0; + return ret; } static int init_qemu(char *path)