libnm/keyfile: fix double free in keyfile's get_bytes()

Fixes: 5e7b14af03
(cherry picked from commit fcf254c03a)
(cherry picked from commit 1c56be4090)
(cherry picked from commit 71e2a25a0d)
This commit is contained in:
Thomas Haller 2018-09-02 14:33:34 +02:00
parent ca231f6c8e
commit fd6acf6183

View file

@ -821,7 +821,7 @@ get_bytes (KeyfileReaderInfo *info,
* byte-array. The reason is that zero_terminate is there to terminate
* *valid* strings. It's not there to terminated invalid (empty) strings.
*/
return g_bytes_new_take (tmp_string, 0);
return g_bytes_new_static ("", 0);
}
for (length = 0; tmp_string[length]; length++) {