]> granicus.if.org Git - file/commitdiff
Coverity CID 4418: don't call strlen() with NULL
authorChristos Zoulas <christos@zoulas.com>
Wed, 16 May 2007 20:51:40 +0000 (20:51 +0000)
committerChristos Zoulas <christos@zoulas.com>
Wed, 16 May 2007 20:51:40 +0000 (20:51 +0000)
src/apprentice.c

index 2c34970d5db9bf184a45a68015374919a824ed15..d5a5bec5129f65d98915e786602e62509116f9b9 100644 (file)
@@ -46,7 +46,7 @@
 #endif
 
 #ifndef        lint
-FILE_RCSID("@(#)$File: apprentice.c,v 1.104 2007/01/19 19:54:39 christos Exp $")
+FILE_RCSID("@(#)$File: apprentice.c,v 1.105 2007/05/16 20:51:40 christos Exp $")
 #endif /* lint */
 
 #define        EATAB {while (isascii((unsigned char) *l) && \
@@ -327,10 +327,11 @@ file_apprentice(struct magic_set *ms, const char *fn, int action)
        if (fn == NULL)
                fn = MAGIC;
 
-       if ((fn = mfn = strdup(fn)) == NULL) {
+       if ((mfn = strdup(fn)) == NULL) {
                file_oomem(ms, strlen(fn));
                return NULL;
        }
+       fn = mfn;
 
        if ((mlist = malloc(sizeof(*mlist))) == NULL) {
                free(mfn);