HMAP_FOR_EACH_SAFE (handle, next,
struct file_handle, name_node, &named_handles)
unname_handle (handle);
+
+ free_handle (inline_file);
}
/* Free HANDLE and remove it from the global list. */
static void
free_handle (struct file_handle *handle)
{
+ if (handle == NULL)
+ return;
+
/* Remove handle from global list. */
if (handle->id != NULL)
hmap_delete (&named_handles, &handle->name_node);
struct file_handle *
fh_ref (struct file_handle *handle)
{
+ if (handle == fh_inline_file ())
+ return handle;
assert (handle->ref_cnt > 0);
handle->ref_cnt++;
return handle;
{
if (handle != NULL)
{
+ if (handle == fh_inline_file ())
+ return;
assert (handle->ref_cnt > 0);
if (--handle->ref_cnt == 0)
free_handle (handle);
])
AT_CLEANUP
+
+
+dnl This was seen to crash pspp
+AT_SETUP([Reusing inline file])
+
+AT_DATA([inline-reuse.sps], [dnl
+get data /type=txt /file=inline /variables=A f7.2 .
+
+data list notable list /foo.
+begin data.
+end data.
+
+data list notable list /foo.
+])
+
+AT_CHECK([pspp inline-reuse.sps], [0], [ignore])
+
+AT_CLEANUP