Skip to content

Commit 392e344

Browse files
committed
fuzz - 12122 - Fix to memory leak by properly free'ing the dirname variable in OLE2 parser.
1 parent 75c8244 commit 392e344

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

libclamav/ole2_extract.c

+6-2
Original file line numberDiff line numberDiff line change
@@ -755,10 +755,16 @@ ole2_walk_property_tree(ole2_header_t *hdr, const char *dir, int32_t prop_index,
755755
func_ret = ret;
756756
} else {
757757
ole2_list_delete(&node_list);
758+
if (dirname)
759+
free(dirname);
758760
return ret;
759761
}
760762
}
761763
}
764+
if (dirname) {
765+
free(dirname);
766+
dirname = NULL;
767+
}
762768
if ((int)(prop_block[idx].prev) != -1) {
763769
if ((ret = ole2_list_push(&node_list, prop_block[idx].prev)) != CL_SUCCESS) {
764770
ole2_list_delete(&node_list);
@@ -771,8 +777,6 @@ ole2_walk_property_tree(ole2_header_t *hdr, const char *dir, int32_t prop_index,
771777
return ret;
772778
}
773779
}
774-
if (dirname)
775-
free(dirname);
776780
break;
777781
default:
778782
cli_dbgmsg("ERROR: unknown OLE2 entry type: %d\n", prop_block[idx].type);

0 commit comments

Comments
 (0)