File tree Expand file tree Collapse file tree 2 files changed +7
-0
lines changed
Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -572,13 +572,17 @@ enum lsof_error lsof_gather(struct lsof_context *ctx,
572572 * You should call `lsof_free_result` to free all `struct lsof_result`
573573 * before destroying the context.
574574 *
575+ * ctx may be NULL.
576+ *
575577 * You must not use the context anymore after this call.
576578 *
577579 * \since API version 1
578580 */
579581void lsof_destroy (struct lsof_context * ctx );
580582
581583/** Free struct lsof_result
584+ *
585+ * result may be NULL.
582586 *
583587 * \since API version 1
584588 */
Original file line number Diff line number Diff line change @@ -732,6 +732,9 @@ void lsof_free_result(struct lsof_result *result) {
732732 int pi , fi ;
733733 struct lsof_process * p ;
734734 struct lsof_file * f ;
735+ if (!result ) {
736+ return ;
737+ }
735738 for (pi = 0 ; pi < result -> num_processes ; pi ++ ) {
736739 p = & result -> processes [pi ];
737740 /* Free files */
You can’t perform that action at this time.
0 commit comments