@@ -301,10 +301,15 @@ int probe_file__get_events(int fd, struct strfilter *filter,
301
301
p = strchr (ent -> s , ':' );
302
302
if ((p && strfilter__compare (filter , p + 1 )) ||
303
303
strfilter__compare (filter , ent -> s )) {
304
- strlist__add (plist , ent -> s );
304
+ ret = strlist__add (plist , ent -> s );
305
+ if (ret == - ENOMEM ) {
306
+ pr_err ("strlist__add failed with -ENOMEM\n" );
307
+ goto out ;
308
+ }
305
309
ret = 0 ;
306
310
}
307
311
}
312
+ out :
308
313
strlist__delete (namelist );
309
314
310
315
return ret ;
@@ -511,7 +516,11 @@ static int probe_cache__load(struct probe_cache *pcache)
511
516
ret = - EINVAL ;
512
517
goto out ;
513
518
}
514
- strlist__add (entry -> tevlist , buf );
519
+ ret = strlist__add (entry -> tevlist , buf );
520
+ if (ret == - ENOMEM ) {
521
+ pr_err ("strlist__add failed with -ENOMEM\n" );
522
+ goto out ;
523
+ }
515
524
}
516
525
}
517
526
out :
@@ -672,7 +681,12 @@ int probe_cache__add_entry(struct probe_cache *pcache,
672
681
command = synthesize_probe_trace_command (& tevs [i ]);
673
682
if (!command )
674
683
goto out_err ;
675
- strlist__add (entry -> tevlist , command );
684
+ ret = strlist__add (entry -> tevlist , command );
685
+ if (ret == - ENOMEM ) {
686
+ pr_err ("strlist__add failed with -ENOMEM\n" );
687
+ goto out_err ;
688
+ }
689
+
676
690
free (command );
677
691
}
678
692
list_add_tail (& entry -> node , & pcache -> entries );
@@ -853,9 +867,15 @@ int probe_cache__scan_sdt(struct probe_cache *pcache, const char *pathname)
853
867
break ;
854
868
}
855
869
856
- strlist__add (entry -> tevlist , buf );
870
+ ret = strlist__add (entry -> tevlist , buf );
871
+
857
872
free (buf );
858
873
entry = NULL ;
874
+
875
+ if (ret == - ENOMEM ) {
876
+ pr_err ("strlist__add failed with -ENOMEM\n" );
877
+ break ;
878
+ }
859
879
}
860
880
if (entry ) {
861
881
list_del_init (& entry -> node );
0 commit comments