We were not freeing up tmp_string if the strdup for basename failed.
Since we anyway need to free up tmp_string and return NULL if the
strdup failed, we don't really care about testing the return value
of the strdup, and therefore this check is not needed. Remove this
check then.
Thanks to Steve Grubb's review at
http://article.gmane.org/gmane.comp.lib.libcg.devel/2485
Reported-by: Steve Grubb <sgrubb@redhat.com>
Signed-off-by: Dhaval Giani <dhaval.giani@gmail.com>
Acked-By: Jan Safranek <jsafrane@redhat.com>
base = strdup(basename(tmp_string));
- if (!base)
- return NULL;
-
free(tmp_string);
return base;