Remove image name/slot from File Output node Error: Not freed memory blocks: 1, total unfreed memory

Is this a bug or am i doing something wrong ?

Test:
Open Blender from the commandline.
Run script that will add a new File Output node, delete the original image name and add a new custom name; then close Blender and the command prompt will kick out “Error: Not freed memory blocks: 1, total unfreed memory”

If i add the File Output node, add a new image name (not touching the original) and then manual delete the original from the Properties panel, Blender closes with out any error.

Also tried newNode.file_slots.clear() and the same error occurs.

Using Blender 3.5

Heres a quick video to demonstrate.

import bpy
# Error: Not freed memory blocks: 1, total unfreed memory
def addOutputFileNode():

    name = "OutTest"
    ntree = bpy.context.scene.node_tree

    newNode = ntree.nodes.new(type='CompositorNodeOutputFile')
    newNode.name = name
    
    newNode.file_slots.remove(newNode.inputs[0])
    newNode.file_slots.new("New Image File Name")
    return newNode

if __name__ == "__main__":
    bpy.context.window.workspace = bpy.data.workspaces['Compositing']
    bpy.data.scenes["Scene"].use_nodes = True
    addOutputFileNode()

To follow up a little, heres a quote from another forum:

After coming across the error in the first place, i changed to :
newNode.file_slots[0].path= "New Image File Name"
which makes more sense, but anyway :slight_smile: