]> jfr.im git - irc/rqf/shadowircd.git/blobdiff - src/cache.c
Fix memory leak and bad error reporting with posix_spawn():
[irc/rqf/shadowircd.git] / src / cache.c
index 58a2f8e4ddfbfb5350bc6493e8108e16d40ccc2e..c8210504f74ab7b17377cb14802cc8224e6c36bb 100644 (file)
@@ -143,6 +143,13 @@ cache_file(const char *filename, const char *shortname, int flags)
                        rb_dlinkAddTailAlloc(emptyline, &cacheptr->contents);
        }
 
+       if (0 == rb_dlink_list_length(&cacheptr->contents))
+       {
+               /* No contents. Don't cache it after all. */
+               rb_free(cacheptr);
+               cacheptr = NULL;
+       }
+
        fclose(in);
        return cacheptr;
 }