Skip to content
Extraits de code Groupes Projets
Valider 50ca4862 rédigé par Etienne BRATEAU's avatar Etienne BRATEAU
Parcourir les fichiers

Remove use of realloc in goodfixname.

It's because all strings are char[256] and not on the heap. And more,
the reallocation was a broken thing because the pointer was not
correctly updated (need return char* or parameter change).

Fix crash when saving and was introduced in d0dbd3e2
parent 3b87c429
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Pipeline #1500 en échec
......@@ -89,7 +89,9 @@ static void goodfixname(char *name, char *ext, char *home, int force)
if (!hassuffix && *ext != '\0')
{
name = realloc(name, sizeof(char) * (len + strlen(ext) + 2)); /* name + '.' + ext + '\0' */
/* Disabling reallocation because all strings are char[256], will change in future */
/* Warning: when doing reallocation, return char* or take char** because of reallocation */
//name = realloc(name, sizeof(char) * (len + strlen(ext) + 2)); /* name + '.' + ext + '\0' */
sprintf(name + strlen(name), ".%s", ext);
}
}
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter