From: Colin Walters Date: Tue, 25 Sep 2012 19:01:54 +0000 (-0400) Subject: main: Quiet compiler warning about free(const char *) X-Git-Tag: 0.8.8~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=db203daca09e50a50a54bd9ed78bf62ba6999969;p=thirdparty%2Fplymouth.git main: Quiet compiler warning about free(const char *) Just make a duplicate variable. --- diff --git a/src/main.c b/src/main.c index e1583bc9..88e50025 100644 --- a/src/main.c +++ b/src/main.c @@ -1857,23 +1857,24 @@ check_verbosity (state_t *state) if (stream != NULL) { char *end; + char *stream_copy; - stream = strdup (stream); - end = stream + strcspn (stream, " \n"); + stream_copy = strdup (stream); + end = stream_copy + strcspn (stream_copy, " \n"); *end = '\0'; - ply_trace ("streaming debug output to %s instead of screen", stream); - fd = open (stream, O_RDWR | O_NOCTTY | O_CREAT, 0600); + ply_trace ("streaming debug output to %s instead of screen", stream_copy); + fd = open (stream_copy, O_RDWR | O_NOCTTY | O_CREAT, 0600); if (fd < 0) { - ply_trace ("could not stream output to %s: %m", stream); + ply_trace ("could not stream output to %s: %m", stream_copy); } else { ply_logger_set_output_fd (ply_logger_get_error_default (), fd); } - free (stream); + free (stream_copy); } } else