Bug in NVFOpen

I don’t use the nv_file.c module to open files but did notice a bug whilst browsing through the code:

NvAPKFile* apk = NvAPKOpen(path);
if (apk)
    handle = (NvFileHandle*) malloc(sizeof(NvFileHandle));
    handle->type = APK_FILE;
    handle->handle = NvAPKOpen(path);

This opens the file from the package twice and leaks the first apk pointer leaving the file handle open.

I believe handle->handle = NvAPKOpen(path); should be handle->handle = apk;


Thanks for reporting this. You are of course correct. We will fix this in an upcoming release of the samples in TADP.