Browse code

xprint: use pkg_reallocxf() to ensure old pointer is freed in case of failure

- fix also potential free of null

Daniel-Constantin Mierla authored on 10/08/2017 08:55:07
Showing 1 changed files
... ...
@@ -1862,9 +1862,8 @@ int xl_mod_init()
1862 1862
 		str_domainname.s = NULL;
1863 1863
 	} else {
1864 1864
 		str_fullname.len = strlen(s);
1865
-		s = pkg_realloc(s, str_fullname.len+1); /* this will leave the ending \0 */
1865
+		s = pkg_reallocxf(s, str_fullname.len+1); /* this will leave the ending \0 */
1866 1866
 		if (!s) { /* should never happen because decreasing size */
1867
-			pkg_free(s);
1868 1867
 			return -1;
1869 1868
 		}
1870 1869
 		str_fullname.s = s;