Fix GString memory leak in read_stream function
The 'stream' GString was not freed before returning from read_stream() in two places: 1. When kill_recv is TRUE at the start of the loop 2. At the end of the function after the loop exits Added g_string_free(stream, TRUE) before both return statements.
This commit is contained in:
@@ -109,6 +109,7 @@ read_stream(void)
|
|||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
if (kill_recv) {
|
if (kill_recv) {
|
||||||
_shutdown();
|
_shutdown();
|
||||||
|
g_string_free(stream, TRUE);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -167,6 +168,7 @@ read_stream(void)
|
|||||||
memset(buf, 0, sizeof(buf));
|
memset(buf, 0, sizeof(buf));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_string_free(stream, TRUE);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user