Parcourir la source

Free tmp string if dirname fails

master
lostd il y a 10 ans
Parent
révision
0809871aeb
1 fichiers modifiés avec 3 ajouts et 1 suppressions
  1. +3
    -1
      noice.c

+ 3
- 1
noice.c Voir le fichier

@@ -128,8 +128,10 @@ xdirname(const char *path)
* original string if we lose track of it. */
tmp = xstrdup(path);
p = dirname(tmp);
if (p == NULL)
if (p == NULL) {
free(tmp);
printerr(1, "dirname");
}
/* Make sure this is a malloc(3)-ed string */
p = xstrdup(p);
free(tmp);


Chargement…
Annuler
Enregistrer